17836SJohn.Forte@Sun.COM /* 27836SJohn.Forte@Sun.COM * Description 37836SJohn.Forte@Sun.COM * ImaLib.c - Implements a sample common IMA library 47836SJohn.Forte@Sun.COM * 57836SJohn.Forte@Sun.COM * License: 67836SJohn.Forte@Sun.COM * The contents of this file are subject to the SNIA Public License 77836SJohn.Forte@Sun.COM * Version 1.0(the "License"); you may not use this file except in 87836SJohn.Forte@Sun.COM * compliance with the License. You may obtain a copy of the License at 97836SJohn.Forte@Sun.COM * 107836SJohn.Forte@Sun.COM * /http://www.snia.org/English/Resources/Code/OpenSource.html 117836SJohn.Forte@Sun.COM * 127836SJohn.Forte@Sun.COM * Software distributed under the License is distributed on an "AS IS" 137836SJohn.Forte@Sun.COM * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 147836SJohn.Forte@Sun.COM * the License for the specific language governing rights and limitations 157836SJohn.Forte@Sun.COM * under the License. 167836SJohn.Forte@Sun.COM * 177836SJohn.Forte@Sun.COM * The Original Code is SNIA HBA API and IMA general header file 187836SJohn.Forte@Sun.COM * 197836SJohn.Forte@Sun.COM * The Initial Developer of the Original Code is: 207836SJohn.Forte@Sun.COM * Benjamin F. Kuo, Troika Networks, Inc. (benk@troikanetworks.com) 217836SJohn.Forte@Sun.COM * David Dillard VERITAS Software david.dillard@veritas.com 227836SJohn.Forte@Sun.COM * 237836SJohn.Forte@Sun.COM * Contributor(s): 247836SJohn.Forte@Sun.COM * Jeff Ding, Adaptec, Inc. (jding@corp.adaptec.com) 257836SJohn.Forte@Sun.COM * 267836SJohn.Forte@Sun.COM * Changes: 277836SJohn.Forte@Sun.COM * 09/24/2003 Initial Draft 287836SJohn.Forte@Sun.COM * (for other changes... see the CVS logs) 297836SJohn.Forte@Sun.COM * 307836SJohn.Forte@Sun.COM * 12/15/2003 corrected the defined parameter in IMA_SetPhbaIsnsDiscovery(). 317836SJohn.Forte@Sun.COM * lower case the computer name as iscsi name in IMA_GenerateNodeName(). 327836SJohn.Forte@Sun.COM * 337836SJohn.Forte@Sun.COM * 01/21/2005 Updated to support IMA 1.1.3. 347836SJohn.Forte@Sun.COM */ 357836SJohn.Forte@Sun.COM 367836SJohn.Forte@Sun.COM #ifdef WIN32 377836SJohn.Forte@Sun.COM #include <windows.h> 387836SJohn.Forte@Sun.COM #else 397836SJohn.Forte@Sun.COM #define _XOPEN_SOURCE /* glibc2 needs this */ 407836SJohn.Forte@Sun.COM #include <sys/sem.h> 417836SJohn.Forte@Sun.COM #include <dlfcn.h> 427836SJohn.Forte@Sun.COM #include <stdarg.h> 437836SJohn.Forte@Sun.COM #endif 447836SJohn.Forte@Sun.COM 457836SJohn.Forte@Sun.COM #include <string.h> 467836SJohn.Forte@Sun.COM #include <stdlib.h> 477836SJohn.Forte@Sun.COM // #include <sys/sem.h> 487836SJohn.Forte@Sun.COM // #include <unistd.h> 497836SJohn.Forte@Sun.COM #include <time.h> 507836SJohn.Forte@Sun.COM #include <stdio.h> 517836SJohn.Forte@Sun.COM #include <sys/types.h> 527836SJohn.Forte@Sun.COM // #include <sys/ipc.h> 537836SJohn.Forte@Sun.COM 54*10156SZhang.Yi@Sun.COM #include "libsun_ima.h" 557836SJohn.Forte@Sun.COM #include "ima.h" 567836SJohn.Forte@Sun.COM #include "ima-plugin.h" 577836SJohn.Forte@Sun.COM 587836SJohn.Forte@Sun.COM 597836SJohn.Forte@Sun.COM #define LIBRARY_PROPERTY_SUPPORTED_IMA_VERSION 1 607836SJohn.Forte@Sun.COM #define LIBRARY_PROPERTY_IMPLEMENTATION_VERSION L"1.0.2" 617836SJohn.Forte@Sun.COM #define LIBRARY_PROPERTY_VENDOR L"QLogic, Inc." 627836SJohn.Forte@Sun.COM #define DEFAULT_NODE_NAME_FORMAT "iqn.1986-03.com.sun.central.%s" 637836SJohn.Forte@Sun.COM 647836SJohn.Forte@Sun.COM /* Linux only */ 657836SJohn.Forte@Sun.COM #define LIBRARY_FILE_NAME L"libima.so" 667836SJohn.Forte@Sun.COM 677836SJohn.Forte@Sun.COM #define EUOS_ERROR IMA_ERROR_UNEXPECTED_OS_ERROR 687836SJohn.Forte@Sun.COM 69*10156SZhang.Yi@Sun.COM IMA_PLUGIN_INFO plugintable[IMA_MAX_NUM_PLUGINS]; 70*10156SZhang.Yi@Sun.COM int number_of_plugins = -1; 717836SJohn.Forte@Sun.COM static IMA_NODE_NAME sharedNodeName; 727836SJohn.Forte@Sun.COM static IMA_NODE_ALIAS sharedNodeAlias; 737836SJohn.Forte@Sun.COM 747836SJohn.Forte@Sun.COM #ifdef WIN32 757836SJohn.Forte@Sun.COM static HANDLE libMutex = NULL; 767836SJohn.Forte@Sun.COM #else 77*10156SZhang.Yi@Sun.COM int libMutex = -1; 787836SJohn.Forte@Sun.COM #endif 797836SJohn.Forte@Sun.COM 807836SJohn.Forte@Sun.COM void InitLibrary(); 817836SJohn.Forte@Sun.COM void ExitLibrary(); 827836SJohn.Forte@Sun.COM 837836SJohn.Forte@Sun.COM static void libSwprintf(wchar_t *wcs, const wchar_t *lpszFormat, ...) { 847836SJohn.Forte@Sun.COM va_list args; 857836SJohn.Forte@Sun.COM va_start(args, lpszFormat); 867836SJohn.Forte@Sun.COM 877836SJohn.Forte@Sun.COM #ifdef WIN32 887836SJohn.Forte@Sun.COM vswprintf(wcs, lpszFormat, args); 897836SJohn.Forte@Sun.COM #else 907836SJohn.Forte@Sun.COM vswprintf(wcs, 255, lpszFormat, args); 917836SJohn.Forte@Sun.COM #endif 927836SJohn.Forte@Sun.COM va_end(args); 937836SJohn.Forte@Sun.COM } 947836SJohn.Forte@Sun.COM 957836SJohn.Forte@Sun.COM 967836SJohn.Forte@Sun.COM #ifdef WIN32 977836SJohn.Forte@Sun.COM /* Begin implementation */ 987836SJohn.Forte@Sun.COM BOOL APIENTRY DllMain(HANDLE hModule, 997836SJohn.Forte@Sun.COM DWORD ul_reason_for_call, 1007836SJohn.Forte@Sun.COM LPVOID lpReserved) { 1017836SJohn.Forte@Sun.COM switch (ul_reason_for_call) { 1027836SJohn.Forte@Sun.COM 1037836SJohn.Forte@Sun.COM case DLL_PROCESS_ATTACH: 1047836SJohn.Forte@Sun.COM // InitLibrary(); 1057836SJohn.Forte@Sun.COM break; 1067836SJohn.Forte@Sun.COM case DLL_PROCESS_DETACH: 1077836SJohn.Forte@Sun.COM ExitLibrary(); 1087836SJohn.Forte@Sun.COM break; 1097836SJohn.Forte@Sun.COM case DLL_THREAD_ATTACH: 1107836SJohn.Forte@Sun.COM case DLL_THREAD_DETACH: 1117836SJohn.Forte@Sun.COM break; 1127836SJohn.Forte@Sun.COM } 1137836SJohn.Forte@Sun.COM return (TRUE); 1147836SJohn.Forte@Sun.COM } 1157836SJohn.Forte@Sun.COM #elif defined(SOLARIS) 1167836SJohn.Forte@Sun.COM 1177836SJohn.Forte@Sun.COM void so_init(void); 1187836SJohn.Forte@Sun.COM void so_fini(void); 1197836SJohn.Forte@Sun.COM static int os_createmutex(int *semid); 1207836SJohn.Forte@Sun.COM static void os_obtainmutex(int semid); 1217836SJohn.Forte@Sun.COM static void os_releasemutex(int semid); 1227836SJohn.Forte@Sun.COM static void os_destroymutex(int semid); 1237836SJohn.Forte@Sun.COM static IMA_STATUS getSolarisNodeProps(IMA_NODE_PROPERTIES *nodeProps); 1247836SJohn.Forte@Sun.COM static IMA_STATUS getSolarisSharedNodeName(IMA_NODE_NAME name); 1257836SJohn.Forte@Sun.COM static IMA_STATUS getSolarisSharedNodeAlias(IMA_NODE_ALIAS alias); 1267836SJohn.Forte@Sun.COM static IMA_STATUS setSolarisSharedNodeName(const IMA_NODE_NAME name); 1277836SJohn.Forte@Sun.COM static IMA_STATUS setSolarisSharedNodeAlias(const IMA_NODE_ALIAS alias); 1287836SJohn.Forte@Sun.COM 1297836SJohn.Forte@Sun.COM #pragma init(so_init) 1307836SJohn.Forte@Sun.COM #pragma fini(so_fini) 1317836SJohn.Forte@Sun.COM 1327836SJohn.Forte@Sun.COM void so_init() { 1337836SJohn.Forte@Sun.COM InitLibrary(); 1347836SJohn.Forte@Sun.COM } 1357836SJohn.Forte@Sun.COM void so_fini() { 1367836SJohn.Forte@Sun.COM ExitLibrary(); 1377836SJohn.Forte@Sun.COM } 1387836SJohn.Forte@Sun.COM 1397836SJohn.Forte@Sun.COM static IMA_STATUS getSolarisNodeProps(IMA_NODE_PROPERTIES *nodeProps) { 1407836SJohn.Forte@Sun.COM int ret; 1417836SJohn.Forte@Sun.COM int i; 1427836SJohn.Forte@Sun.COM IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; 1437836SJohn.Forte@Sun.COM IMA_GetNodePropertiesFn PassFunc; 1447836SJohn.Forte@Sun.COM IMA_OID nodeOid; 1457836SJohn.Forte@Sun.COM 1467836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 1477836SJohn.Forte@Sun.COM InitLibrary(); 1487836SJohn.Forte@Sun.COM 1497836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 1507836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 1517836SJohn.Forte@Sun.COM 1527836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1537836SJohn.Forte@Sun.COM if (strstr(plugintable[i].PluginPath, 1547836SJohn.Forte@Sun.COM "libsun_ima.so") == NULL) { 1557836SJohn.Forte@Sun.COM continue; 1567836SJohn.Forte@Sun.COM } 1577836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 1587836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 1597836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 1607836SJohn.Forte@Sun.COM PassFunc = 1617836SJohn.Forte@Sun.COM (IMA_GetNodePropertiesFn) dlsym( 1627836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 1637836SJohn.Forte@Sun.COM "IMA_GetNodeProperties"); 1647836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 1657836SJohn.Forte@Sun.COM status = PassFunc(nodeOid, nodeProps); 1667836SJohn.Forte@Sun.COM } 1677836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 1687836SJohn.Forte@Sun.COM } 1697836SJohn.Forte@Sun.COM break; 1707836SJohn.Forte@Sun.COM } 1717836SJohn.Forte@Sun.COM 1727836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1737836SJohn.Forte@Sun.COM return (status); 1747836SJohn.Forte@Sun.COM } 1757836SJohn.Forte@Sun.COM 1767836SJohn.Forte@Sun.COM static IMA_STATUS getSolarisSharedNodeName(IMA_NODE_NAME name) { 1777836SJohn.Forte@Sun.COM IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; 1787836SJohn.Forte@Sun.COM IMA_NODE_PROPERTIES nodeProps; 1797836SJohn.Forte@Sun.COM 1807836SJohn.Forte@Sun.COM status = getSolarisNodeProps(&nodeProps); 1817836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 1827836SJohn.Forte@Sun.COM return (status); 1837836SJohn.Forte@Sun.COM } 1847836SJohn.Forte@Sun.COM bcopy(&nodeProps.name, name, sizeof (IMA_NODE_NAME)); 1857836SJohn.Forte@Sun.COM return (status); 1867836SJohn.Forte@Sun.COM } 1877836SJohn.Forte@Sun.COM 1887836SJohn.Forte@Sun.COM static IMA_STATUS getSolarisSharedNodeAlias(IMA_NODE_ALIAS alias) { 1897836SJohn.Forte@Sun.COM IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; 1907836SJohn.Forte@Sun.COM IMA_NODE_PROPERTIES nodeProps; 1917836SJohn.Forte@Sun.COM 1927836SJohn.Forte@Sun.COM status = getSolarisNodeProps(&nodeProps); 1937836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 1947836SJohn.Forte@Sun.COM return (status); 1957836SJohn.Forte@Sun.COM } 1967836SJohn.Forte@Sun.COM bcopy(&nodeProps.alias, alias, sizeof (IMA_NODE_ALIAS)); 1977836SJohn.Forte@Sun.COM return (status); 1987836SJohn.Forte@Sun.COM } 1997836SJohn.Forte@Sun.COM 2007836SJohn.Forte@Sun.COM static IMA_STATUS setSolarisSharedNodeName(const IMA_NODE_NAME name) { 2017836SJohn.Forte@Sun.COM int ret; 2027836SJohn.Forte@Sun.COM int i; 2037836SJohn.Forte@Sun.COM IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; 2047836SJohn.Forte@Sun.COM IMA_NODE_PROPERTIES nodeProps; 2057836SJohn.Forte@Sun.COM IMA_SetNodeNameFn PassFunc; 2067836SJohn.Forte@Sun.COM IMA_OID nodeOid; 2077836SJohn.Forte@Sun.COM 2087836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2097836SJohn.Forte@Sun.COM InitLibrary(); 2107836SJohn.Forte@Sun.COM 2117836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2127836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2137836SJohn.Forte@Sun.COM 2147836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2157836SJohn.Forte@Sun.COM if (strstr(plugintable[i].PluginPath, 2167836SJohn.Forte@Sun.COM "libsun_ima.so") == NULL) { 2177836SJohn.Forte@Sun.COM continue; 2187836SJohn.Forte@Sun.COM } 2197836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2207836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2217836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2227836SJohn.Forte@Sun.COM PassFunc = 2237836SJohn.Forte@Sun.COM (IMA_SetNodeNameFn) dlsym(plugintable[i].hPlugin, 2247836SJohn.Forte@Sun.COM "IMA_SetNodeName"); 2257836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2267836SJohn.Forte@Sun.COM status = PassFunc(nodeOid, name); 2277836SJohn.Forte@Sun.COM } 2287836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2297836SJohn.Forte@Sun.COM } 2307836SJohn.Forte@Sun.COM break; 2317836SJohn.Forte@Sun.COM } 2327836SJohn.Forte@Sun.COM 2337836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2347836SJohn.Forte@Sun.COM return (status); 2357836SJohn.Forte@Sun.COM } 2367836SJohn.Forte@Sun.COM 2377836SJohn.Forte@Sun.COM static IMA_STATUS setSolarisSharedNodeAlias(const IMA_NODE_ALIAS alias) { 2387836SJohn.Forte@Sun.COM int ret; 2397836SJohn.Forte@Sun.COM int i; 2407836SJohn.Forte@Sun.COM IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; 2417836SJohn.Forte@Sun.COM IMA_NODE_PROPERTIES nodeProps; 2427836SJohn.Forte@Sun.COM IMA_SetNodeAliasFn PassFunc; 2437836SJohn.Forte@Sun.COM IMA_OID nodeOid; 2447836SJohn.Forte@Sun.COM 2457836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2467836SJohn.Forte@Sun.COM InitLibrary(); 2477836SJohn.Forte@Sun.COM 2487836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2497836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2507836SJohn.Forte@Sun.COM 2517836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2527836SJohn.Forte@Sun.COM if (strstr(plugintable[i].PluginPath, 2537836SJohn.Forte@Sun.COM "libsun_ima.so") == NULL) { 2547836SJohn.Forte@Sun.COM continue; 2557836SJohn.Forte@Sun.COM } 2567836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2577836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2587836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2597836SJohn.Forte@Sun.COM PassFunc = 2607836SJohn.Forte@Sun.COM (IMA_SetNodeAliasFn) dlsym(plugintable[i].hPlugin, 2617836SJohn.Forte@Sun.COM "IMA_SetNodeAlias"); 2627836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2637836SJohn.Forte@Sun.COM status = PassFunc(nodeOid, alias); 2647836SJohn.Forte@Sun.COM } 2657836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2667836SJohn.Forte@Sun.COM } 2677836SJohn.Forte@Sun.COM break; 2687836SJohn.Forte@Sun.COM } 2697836SJohn.Forte@Sun.COM 2707836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2717836SJohn.Forte@Sun.COM return (status); 2727836SJohn.Forte@Sun.COM } 2737836SJohn.Forte@Sun.COM 2747836SJohn.Forte@Sun.COM #else 2757836SJohn.Forte@Sun.COM /* 2767836SJohn.Forte@Sun.COM * add code in .init and .fini, 2777836SJohn.Forte@Sun.COM * "__attribute__ ((constructor))" and "__attribute__ ((destructor))" 2787836SJohn.Forte@Sun.COM * are used with gcc 2797836SJohn.Forte@Sun.COM */ 2807836SJohn.Forte@Sun.COM __attribute__ ((constructor)) void init() { 2817836SJohn.Forte@Sun.COM InitLibrary(); 2827836SJohn.Forte@Sun.COM } 2837836SJohn.Forte@Sun.COM 2847836SJohn.Forte@Sun.COM __attribute__ ((destructor)) void fini() { 2857836SJohn.Forte@Sun.COM ExitLibrary(); 2867836SJohn.Forte@Sun.COM } 2877836SJohn.Forte@Sun.COM 2887836SJohn.Forte@Sun.COM #endif 2897836SJohn.Forte@Sun.COM 2907836SJohn.Forte@Sun.COM 2917836SJohn.Forte@Sun.COM #ifdef WIN32 2927836SJohn.Forte@Sun.COM 2937836SJohn.Forte@Sun.COM static BOOL os_createmutex(HANDLE Mutex) { 2947836SJohn.Forte@Sun.COM Mutex = CreateMutex(NULL, FALSE, NULL); 2957836SJohn.Forte@Sun.COM 2967836SJohn.Forte@Sun.COM if (Mutex == NULL) { 2977836SJohn.Forte@Sun.COM return (FALSE); 2987836SJohn.Forte@Sun.COM } 2997836SJohn.Forte@Sun.COM 3007836SJohn.Forte@Sun.COM return (TRUE); 3017836SJohn.Forte@Sun.COM } 3027836SJohn.Forte@Sun.COM 3037836SJohn.Forte@Sun.COM static void os_destroymutex(HANDLE Mutex) { 3047836SJohn.Forte@Sun.COM if (Mutex != NULL) { 3057836SJohn.Forte@Sun.COM CloseHandle(Mutex); 3067836SJohn.Forte@Sun.COM } 3077836SJohn.Forte@Sun.COM } 3087836SJohn.Forte@Sun.COM 3097836SJohn.Forte@Sun.COM 3107836SJohn.Forte@Sun.COM static void os_obtainmutex(HANDLE Mutex) { 3117836SJohn.Forte@Sun.COM WaitForSingleObject(Mutex, INFINITE); 3127836SJohn.Forte@Sun.COM } 3137836SJohn.Forte@Sun.COM 3147836SJohn.Forte@Sun.COM static void os_releasemutex(HANDLE Mutex) { 3157836SJohn.Forte@Sun.COM ReleaseMutex(Mutex); 3167836SJohn.Forte@Sun.COM } 3177836SJohn.Forte@Sun.COM 3187836SJohn.Forte@Sun.COM #else 3197836SJohn.Forte@Sun.COM #if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) 3207836SJohn.Forte@Sun.COM /* <sys/sem.h> */ 3217836SJohn.Forte@Sun.COM #else 3227836SJohn.Forte@Sun.COM union semun { 3237836SJohn.Forte@Sun.COM int val; /* value for SETVAL */ 3247836SJohn.Forte@Sun.COM struct semid_ds *bf; /* buffer for IPC_STAT, IPC_SET */ 3257836SJohn.Forte@Sun.COM unsigned short int *array; /* array for GETALL, SETALL */ 3267836SJohn.Forte@Sun.COM struct seminfo *__buf; /* buffer for IPC_INFO */ 3277836SJohn.Forte@Sun.COM }; 3287836SJohn.Forte@Sun.COM #endif 3297836SJohn.Forte@Sun.COM 3307836SJohn.Forte@Sun.COM /* Create the semaphore. Return 1 if successful, 0 otherwise */ 3317836SJohn.Forte@Sun.COM static int os_createmutex(int *semid) { 3327836SJohn.Forte@Sun.COM int retVal; 3337836SJohn.Forte@Sun.COM union semun sem_union; 3347836SJohn.Forte@Sun.COM 3357836SJohn.Forte@Sun.COM if (semid == NULL) { 3367836SJohn.Forte@Sun.COM return (0); 3377836SJohn.Forte@Sun.COM } 3387836SJohn.Forte@Sun.COM 3397836SJohn.Forte@Sun.COM retVal = semget(IPC_PRIVATE, 1, IPC_CREAT); 3407836SJohn.Forte@Sun.COM if (retVal == -1) { 3417836SJohn.Forte@Sun.COM return (0); 3427836SJohn.Forte@Sun.COM } 3437836SJohn.Forte@Sun.COM 3447836SJohn.Forte@Sun.COM *semid = retVal; /* save key of created semaphore */ 3457836SJohn.Forte@Sun.COM sem_union.val = 1; /* start semaphore off signaled */ 3467836SJohn.Forte@Sun.COM retVal = semctl(*semid, 0, SETVAL, sem_union); 3477836SJohn.Forte@Sun.COM if (retVal == -1) { 3487836SJohn.Forte@Sun.COM return (0); 3497836SJohn.Forte@Sun.COM } 3507836SJohn.Forte@Sun.COM 3517836SJohn.Forte@Sun.COM return (1); 3527836SJohn.Forte@Sun.COM } 3537836SJohn.Forte@Sun.COM 3547836SJohn.Forte@Sun.COM static void os_obtainmutex(int semid) { 3557836SJohn.Forte@Sun.COM int retVal; 3567836SJohn.Forte@Sun.COM struct sembuf sem_b; 3577836SJohn.Forte@Sun.COM 3587836SJohn.Forte@Sun.COM sem_b.sem_num = 0; 3597836SJohn.Forte@Sun.COM sem_b.sem_op = -1; 3607836SJohn.Forte@Sun.COM sem_b.sem_flg = SEM_UNDO; 3617836SJohn.Forte@Sun.COM retVal = semop(semid, &sem_b, 1); 3627836SJohn.Forte@Sun.COM 3637836SJohn.Forte@Sun.COM } 3647836SJohn.Forte@Sun.COM 3657836SJohn.Forte@Sun.COM static void os_releasemutex(int semid) { 3667836SJohn.Forte@Sun.COM int retVal; 3677836SJohn.Forte@Sun.COM struct sembuf sem_b; 3687836SJohn.Forte@Sun.COM 3697836SJohn.Forte@Sun.COM sem_b.sem_num = 0; 3707836SJohn.Forte@Sun.COM sem_b.sem_op = 1; 3717836SJohn.Forte@Sun.COM sem_b.sem_flg = SEM_UNDO; 3727836SJohn.Forte@Sun.COM retVal = semop(semid, &sem_b, 1); 3737836SJohn.Forte@Sun.COM 3747836SJohn.Forte@Sun.COM } 3757836SJohn.Forte@Sun.COM 3767836SJohn.Forte@Sun.COM /* Destroy the SNMP semaphore. */ 3777836SJohn.Forte@Sun.COM static void os_destroymutex(int semid) { 3787836SJohn.Forte@Sun.COM int retVal; 3797836SJohn.Forte@Sun.COM union semun sem_union; 3807836SJohn.Forte@Sun.COM 3817836SJohn.Forte@Sun.COM retVal = semctl(semid, 0, IPC_RMID, sem_union); 3827836SJohn.Forte@Sun.COM 3837836SJohn.Forte@Sun.COM } 3847836SJohn.Forte@Sun.COM #endif 3857836SJohn.Forte@Sun.COM 3867836SJohn.Forte@Sun.COM 3877836SJohn.Forte@Sun.COM void InitLibrary() { 3887836SJohn.Forte@Sun.COM 3897836SJohn.Forte@Sun.COM FILE *imaconf; 3907836SJohn.Forte@Sun.COM char fullline[512]; /* Full line read in from IMA.conf */ 3917836SJohn.Forte@Sun.COM char pluginname[64]; /* Read in from file IMA.conf */ 3927836SJohn.Forte@Sun.COM char pluginpath[256]; /* Read in from file IMA.conf */ 3937836SJohn.Forte@Sun.COM char imaConfFilePath[256]; 3947836SJohn.Forte@Sun.COM char systemPath[256]; 3957836SJohn.Forte@Sun.COM char *charPtr; 3967836SJohn.Forte@Sun.COM IMA_UINT dwStrLength; 3977836SJohn.Forte@Sun.COM 3987836SJohn.Forte@Sun.COM IMA_UINT i = 0; 3997836SJohn.Forte@Sun.COM 4007836SJohn.Forte@Sun.COM if (number_of_plugins != -1) 4017836SJohn.Forte@Sun.COM return; 4027836SJohn.Forte@Sun.COM 4037836SJohn.Forte@Sun.COM number_of_plugins = 0; 4047836SJohn.Forte@Sun.COM 4057836SJohn.Forte@Sun.COM if (os_createmutex(&libMutex) == 0) { 4067836SJohn.Forte@Sun.COM return; 4077836SJohn.Forte@Sun.COM } 4087836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4097836SJohn.Forte@Sun.COM 4107836SJohn.Forte@Sun.COM sharedNodeAlias[0] = 0; 4117836SJohn.Forte@Sun.COM dwStrLength = 255; 4127836SJohn.Forte@Sun.COM 4137836SJohn.Forte@Sun.COM 4147836SJohn.Forte@Sun.COM 4157836SJohn.Forte@Sun.COM /* Open configuration file from known location */ 4167836SJohn.Forte@Sun.COM #ifdef WIN32 4177836SJohn.Forte@Sun.COM if (GetSystemDirectory(systemPath, sizeof (systemPath))) 4187836SJohn.Forte@Sun.COM sprintf(imaConfFilePath, "%s\\drivers\\etc\\ima.conf", 4197836SJohn.Forte@Sun.COM systemPath); 4207836SJohn.Forte@Sun.COM else 4217836SJohn.Forte@Sun.COM strcpy(imaConfFilePath, "ima.conf"); 4227836SJohn.Forte@Sun.COM #else 4237836SJohn.Forte@Sun.COM strcpy(imaConfFilePath, "/etc/ima.conf"); 4247836SJohn.Forte@Sun.COM #endif 4257836SJohn.Forte@Sun.COM 4267836SJohn.Forte@Sun.COM if ((imaconf = fopen(imaConfFilePath, "r")) == NULL) { 4277836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4287836SJohn.Forte@Sun.COM return; 4297836SJohn.Forte@Sun.COM } 4307836SJohn.Forte@Sun.COM /* Read in each line and load library */ 4317836SJohn.Forte@Sun.COM while ((imaconf != NULL) && 4327836SJohn.Forte@Sun.COM (fgets(fullline, sizeof (fullline), imaconf))) { 4337836SJohn.Forte@Sun.COM if ((fullline[0] != '#') && (fullline[0] != '\n')) { 4347836SJohn.Forte@Sun.COM /* Take out the '\n' */ 4357836SJohn.Forte@Sun.COM if ((charPtr = (char *)strchr(fullline, '\n')) != NULL) 4367836SJohn.Forte@Sun.COM *charPtr = '\0'; 4377836SJohn.Forte@Sun.COM 4387836SJohn.Forte@Sun.COM /* look for the first tab */ 4397836SJohn.Forte@Sun.COM if ((charPtr = (char *)strchr(fullline, '\t')) == NULL) 4407836SJohn.Forte@Sun.COM charPtr = (char *)strchr(fullline, ' '); 4417836SJohn.Forte@Sun.COM 4427836SJohn.Forte@Sun.COM /* Set Null termination for library name if found */ 4437836SJohn.Forte@Sun.COM if (charPtr != NULL) { 4447836SJohn.Forte@Sun.COM *charPtr++ = '\0'; 4457836SJohn.Forte@Sun.COM /* 4467836SJohn.Forte@Sun.COM * Skip spaces and tabs until 4477836SJohn.Forte@Sun.COM * the next character found 4487836SJohn.Forte@Sun.COM */ 4497836SJohn.Forte@Sun.COM while ((*charPtr == ' ') || (*charPtr == '\t')) 4507836SJohn.Forte@Sun.COM charPtr++; 4517836SJohn.Forte@Sun.COM } 4527836SJohn.Forte@Sun.COM else 4537836SJohn.Forte@Sun.COM continue; /* May be invalid entry */ 4547836SJohn.Forte@Sun.COM 4557836SJohn.Forte@Sun.COM /* Copy library name and path */ 4567836SJohn.Forte@Sun.COM strcpy(pluginname, fullline); 4577836SJohn.Forte@Sun.COM strcpy(pluginpath, charPtr); 4587836SJohn.Forte@Sun.COM 4597836SJohn.Forte@Sun.COM /* 4607836SJohn.Forte@Sun.COM * Continue to the next line if library name or 4617836SJohn.Forte@Sun.COM * path is invalid 4627836SJohn.Forte@Sun.COM */ 4637836SJohn.Forte@Sun.COM if ((strlen(pluginname) == 0) || 4647836SJohn.Forte@Sun.COM (strlen(pluginpath) == 0)) 4657836SJohn.Forte@Sun.COM continue; 4667836SJohn.Forte@Sun.COM 4677836SJohn.Forte@Sun.COM #ifdef WIN32 4687836SJohn.Forte@Sun.COM /* Load the DLL now */ 4697836SJohn.Forte@Sun.COM plugintable[i].hPlugin = LoadLibrary(pluginpath); 4707836SJohn.Forte@Sun.COM #else 4717836SJohn.Forte@Sun.COM /* Load the DLL now */ 4727836SJohn.Forte@Sun.COM plugintable[i].hPlugin = dlopen(pluginpath, RTLD_LAZY); 4737836SJohn.Forte@Sun.COM #endif 4747836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4757836SJohn.Forte@Sun.COM typedef int (*InitializeFn)(); 4767836SJohn.Forte@Sun.COM InitializeFn PassFunc; 4777836SJohn.Forte@Sun.COM IMA_STATUS status; 4787836SJohn.Forte@Sun.COM 4797836SJohn.Forte@Sun.COM memcpy((char *)&plugintable[i].PluginName, 4807836SJohn.Forte@Sun.COM (char *)&pluginname, 64); 4817836SJohn.Forte@Sun.COM memcpy((char *) 4827836SJohn.Forte@Sun.COM &plugintable[i].PluginPath, 4837836SJohn.Forte@Sun.COM (char *)&pluginpath, 256); 4847836SJohn.Forte@Sun.COM plugintable[i].ownerId = i + 1; 4857836SJohn.Forte@Sun.COM 4867836SJohn.Forte@Sun.COM #ifdef WIN32 4877836SJohn.Forte@Sun.COM PassFunc = (InitializeFn) 4887836SJohn.Forte@Sun.COM GetProcAddress( 4897836SJohn.Forte@Sun.COM plugintable[i].hPlugin, "Initialize"); 4907836SJohn.Forte@Sun.COM #else 4917836SJohn.Forte@Sun.COM PassFunc = (InitializeFn) 4927836SJohn.Forte@Sun.COM dlsym( 4937836SJohn.Forte@Sun.COM plugintable[i].hPlugin, "Initialize"); 4947836SJohn.Forte@Sun.COM #endif 4957836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4967836SJohn.Forte@Sun.COM status = 4977836SJohn.Forte@Sun.COM PassFunc(plugintable[i].ownerId); 4987836SJohn.Forte@Sun.COM } 4997836SJohn.Forte@Sun.COM 5007836SJohn.Forte@Sun.COM plugintable[i].number_of_vbcallbacks = 0; 5017836SJohn.Forte@Sun.COM plugintable[i].number_of_pccallbacks = 0; 5027836SJohn.Forte@Sun.COM os_createmutex(&(plugintable[i].pluginMutex)); 5037836SJohn.Forte@Sun.COM i++; 5047836SJohn.Forte@Sun.COM } 5057836SJohn.Forte@Sun.COM } 5067836SJohn.Forte@Sun.COM } 5077836SJohn.Forte@Sun.COM number_of_plugins = i; 5087836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5097836SJohn.Forte@Sun.COM } 5107836SJohn.Forte@Sun.COM 5117836SJohn.Forte@Sun.COM 5127836SJohn.Forte@Sun.COM void ExitLibrary() { 5137836SJohn.Forte@Sun.COM IMA_UINT j; 5147836SJohn.Forte@Sun.COM IMA_UINT i; 5157836SJohn.Forte@Sun.COM 5167836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5177836SJohn.Forte@Sun.COM return; 5187836SJohn.Forte@Sun.COM 5197836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5207836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5217836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5227836SJohn.Forte@Sun.COM TerminateFn ExitPassFunc; 5237836SJohn.Forte@Sun.COM 5247836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5257836SJohn.Forte@Sun.COM for (j = 0; j < plugintable[i].number_of_vbcallbacks; 5267836SJohn.Forte@Sun.COM j++) { 5277836SJohn.Forte@Sun.COM #define IMA_DFOBC_STR "IMA_DeregisterForObjectVisibilityChangesFn" 5287836SJohn.Forte@Sun.COM IMA_DeregisterForObjectVisibilityChangesFn 5297836SJohn.Forte@Sun.COM PassFunc; 5307836SJohn.Forte@Sun.COM #ifdef WIN32 5317836SJohn.Forte@Sun.COM PassFunc = 5327836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectVisibilityChangesFn) 5337836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5347836SJohn.Forte@Sun.COM IMA_DFOBC_STR); 5357836SJohn.Forte@Sun.COM #else 5367836SJohn.Forte@Sun.COM PassFunc = 5377836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectVisibilityChangesFn) 5387836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5397836SJohn.Forte@Sun.COM IMA_DFOBC_STR); 5407836SJohn.Forte@Sun.COM #endif 5417836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5427836SJohn.Forte@Sun.COM PassFunc(plugintable[i].vbcallback[j]); 5437836SJohn.Forte@Sun.COM } 5447836SJohn.Forte@Sun.COM #undef IMA_DFOBC_STR 5457836SJohn.Forte@Sun.COM } 5467836SJohn.Forte@Sun.COM plugintable[i].number_of_vbcallbacks = 0; 5477836SJohn.Forte@Sun.COM 5487836SJohn.Forte@Sun.COM for (j = 0; j < plugintable[i].number_of_pccallbacks; 5497836SJohn.Forte@Sun.COM j++) { 5507836SJohn.Forte@Sun.COM IMA_DeregisterForObjectPropertyChangesFn 5517836SJohn.Forte@Sun.COM PassFunc; 5527836SJohn.Forte@Sun.COM #ifdef WIN32 5537836SJohn.Forte@Sun.COM PassFunc = 5547836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectPropertyChangesFn) 5557836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5567836SJohn.Forte@Sun.COM "IMA_DeregisterForObjectPropertyChangesFn"); 5577836SJohn.Forte@Sun.COM #else 5587836SJohn.Forte@Sun.COM PassFunc = 5597836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectPropertyChangesFn) 5607836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5617836SJohn.Forte@Sun.COM "IMA_DeregisterForObjectPropertyChangesFn"); 5627836SJohn.Forte@Sun.COM #endif 5637836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5647836SJohn.Forte@Sun.COM PassFunc(plugintable[i].pccallback[j]); 5657836SJohn.Forte@Sun.COM } 5667836SJohn.Forte@Sun.COM } 5677836SJohn.Forte@Sun.COM plugintable[i].number_of_pccallbacks = 0; 5687836SJohn.Forte@Sun.COM 5697836SJohn.Forte@Sun.COM #ifdef WIN32 5707836SJohn.Forte@Sun.COM ExitPassFunc = 5717836SJohn.Forte@Sun.COM (TerminateFn) GetProcAddress 5727836SJohn.Forte@Sun.COM (plugintable[i].hPlugin, "Terminate"); 5737836SJohn.Forte@Sun.COM #else 5747836SJohn.Forte@Sun.COM ExitPassFunc = (TerminateFn) 5757836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, "Terminate"); 5767836SJohn.Forte@Sun.COM #endif 5777836SJohn.Forte@Sun.COM if (ExitPassFunc != NULL) { 5787836SJohn.Forte@Sun.COM ExitPassFunc(); 5797836SJohn.Forte@Sun.COM } 5807836SJohn.Forte@Sun.COM #ifdef WIN32 5817836SJohn.Forte@Sun.COM /* Unload DLL from memory */ 5827836SJohn.Forte@Sun.COM FreeLibrary(plugintable[i].hPlugin); 5837836SJohn.Forte@Sun.COM #else 5847836SJohn.Forte@Sun.COM /* Unload DLL from memory */ 5857836SJohn.Forte@Sun.COM dlclose(plugintable[i].hPlugin); 5867836SJohn.Forte@Sun.COM #endif 5877836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5887836SJohn.Forte@Sun.COM os_destroymutex(plugintable[i].pluginMutex); 5897836SJohn.Forte@Sun.COM } 5907836SJohn.Forte@Sun.COM } 5917836SJohn.Forte@Sun.COM number_of_plugins = -1; 5927836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5937836SJohn.Forte@Sun.COM os_destroymutex(libMutex); 5947836SJohn.Forte@Sun.COM } 5957836SJohn.Forte@Sun.COM 5967836SJohn.Forte@Sun.COM 5977836SJohn.Forte@Sun.COM static void VisibilityCallback( 5987836SJohn.Forte@Sun.COM IMA_BOOL becomingVisible, 5997836SJohn.Forte@Sun.COM IMA_OID objectId) { 6007836SJohn.Forte@Sun.COM IMA_UINT i, j; 6017836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6027836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6037836SJohn.Forte@Sun.COM if ((plugintable[i].hPlugin != NULL) && 6047836SJohn.Forte@Sun.COM (objectId.ownerId == plugintable[i].ownerId)) { 6057836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6067836SJohn.Forte@Sun.COM for (j = 0; 6077836SJohn.Forte@Sun.COM j < plugintable[i].number_of_vbcallbacks; 6087836SJohn.Forte@Sun.COM j++) { 6097836SJohn.Forte@Sun.COM (plugintable[i].vbcallback[j]) 6107836SJohn.Forte@Sun.COM (becomingVisible, objectId); 6117836SJohn.Forte@Sun.COM } 6127836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6137836SJohn.Forte@Sun.COM } 6147836SJohn.Forte@Sun.COM } 6157836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6167836SJohn.Forte@Sun.COM 6177836SJohn.Forte@Sun.COM } 6187836SJohn.Forte@Sun.COM 6197836SJohn.Forte@Sun.COM static void PropertyCallback( 6207836SJohn.Forte@Sun.COM IMA_OID objectId) { 6217836SJohn.Forte@Sun.COM IMA_UINT i, j; 6227836SJohn.Forte@Sun.COM 6237836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6247836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6257836SJohn.Forte@Sun.COM if ((plugintable[i].hPlugin != NULL) && 6267836SJohn.Forte@Sun.COM (objectId.ownerId == plugintable[i].ownerId)) { 6277836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6287836SJohn.Forte@Sun.COM for (j = 0; 6297836SJohn.Forte@Sun.COM j < plugintable[i].number_of_pccallbacks; 6307836SJohn.Forte@Sun.COM j++) { 6317836SJohn.Forte@Sun.COM (plugintable[i].pccallback[j])(objectId); 6327836SJohn.Forte@Sun.COM } 6337836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6347836SJohn.Forte@Sun.COM } 6357836SJohn.Forte@Sun.COM } 6367836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6377836SJohn.Forte@Sun.COM } 6387836SJohn.Forte@Sun.COM 6397836SJohn.Forte@Sun.COM /* 6407836SJohn.Forte@Sun.COM * Gets the date and time, in the form of an IMA_DATETIME, from the build 6417836SJohn.Forte@Sun.COM * script when compiled. 6427836SJohn.Forte@Sun.COM */ 6437836SJohn.Forte@Sun.COM static void GetBuildTime(IMA_DATETIME* pdatetime) { 6447836SJohn.Forte@Sun.COM 6457836SJohn.Forte@Sun.COM #ifdef WIN32 6467836SJohn.Forte@Sun.COM char *dayToken[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; 6477836SJohn.Forte@Sun.COM char *monthToken[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", 6487836SJohn.Forte@Sun.COM "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; 6497836SJohn.Forte@Sun.COM char monthString[4]; 6507836SJohn.Forte@Sun.COM char dayString[4]; 6517836SJohn.Forte@Sun.COM int i; 6527836SJohn.Forte@Sun.COM 6537836SJohn.Forte@Sun.COM sscanf(__TIME__, "%u:%u:%u", &pdatetime->tm_hour, 6547836SJohn.Forte@Sun.COM &pdatetime->tm_min, &pdatetime->tm_sec); 6557836SJohn.Forte@Sun.COM sscanf(__DATE__, "%s %u %u", monthString, 6567836SJohn.Forte@Sun.COM &pdatetime->tm_mday, &pdatetime->tm_year); 6577836SJohn.Forte@Sun.COM sscanf(__TIMESTAMP__, "%s", dayString); 6587836SJohn.Forte@Sun.COM 6597836SJohn.Forte@Sun.COM pdatetime->tm_year -= 1900; 6607836SJohn.Forte@Sun.COM pdatetime->tm_isdst = -1; 6617836SJohn.Forte@Sun.COM 6627836SJohn.Forte@Sun.COM pdatetime->tm_wday = 0; 6637836SJohn.Forte@Sun.COM for (i = 0; i < 7; i++) { 6647836SJohn.Forte@Sun.COM if (strcmp(dayToken[i], dayString) == 0) { 6657836SJohn.Forte@Sun.COM pdatetime->tm_wday = i; 6667836SJohn.Forte@Sun.COM break; 6677836SJohn.Forte@Sun.COM } 6687836SJohn.Forte@Sun.COM } 6697836SJohn.Forte@Sun.COM 6707836SJohn.Forte@Sun.COM pdatetime->tm_mon = 0; 6717836SJohn.Forte@Sun.COM for (i = 0; i < 12; i++) { 6727836SJohn.Forte@Sun.COM if (strcmp(monthToken[i], monthString) == 0) { 6737836SJohn.Forte@Sun.COM pdatetime->tm_mon = i; 6747836SJohn.Forte@Sun.COM break; 6757836SJohn.Forte@Sun.COM } 6767836SJohn.Forte@Sun.COM } 6777836SJohn.Forte@Sun.COM 6787836SJohn.Forte@Sun.COM #else 6797836SJohn.Forte@Sun.COM #if defined(BUILD_DATE) 6807836SJohn.Forte@Sun.COM if (strptime(BUILD_DATE, "%Y/%m/%d %T %Z", pdatetime) == NULL) { 6817836SJohn.Forte@Sun.COM memset(pdatetime, 0, sizeof (IMA_DATETIME)); 6827836SJohn.Forte@Sun.COM } 6837836SJohn.Forte@Sun.COM #else 6847836SJohn.Forte@Sun.COM memset(pdatetime, 0, sizeof (IMA_DATETIME)); 6857836SJohn.Forte@Sun.COM #endif 6867836SJohn.Forte@Sun.COM #endif 6877836SJohn.Forte@Sun.COM 6887836SJohn.Forte@Sun.COM } 6897836SJohn.Forte@Sun.COM 6907836SJohn.Forte@Sun.COM 6917836SJohn.Forte@Sun.COM 6927836SJohn.Forte@Sun.COM /* 6937836SJohn.Forte@Sun.COM * Gets the properties of the IMA library that is being used. 6947836SJohn.Forte@Sun.COM * 6957836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref IMA_LIBRARY_PROPERTIES structure 6967836SJohn.Forte@Sun.COM * allocated by the caller. On successful return this structure will 6977836SJohn.Forte@Sun.COM * contain the properties of the IMA library. 6987836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 6997836SJohn.Forte@Sun.COM * an error occurred. 7007836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the library properties were successfully 7017836SJohn.Forte@Sun.COM * returned. 7027836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL or 7037836SJohn.Forte@Sun.COM * specifies a memory area to which data cannot be written. 7047836SJohn.Forte@Sun.COM */ 7057836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLibraryProperties( 7067836SJohn.Forte@Sun.COM IMA_LIBRARY_PROPERTIES *pProps) { 7077836SJohn.Forte@Sun.COM 7087836SJohn.Forte@Sun.COM char imaPath[256]; 7097836SJohn.Forte@Sun.COM #ifdef WIN32 7107836SJohn.Forte@Sun.COM HMODULE imaHandle; 7117836SJohn.Forte@Sun.COM #endif 7127836SJohn.Forte@Sun.COM 7137836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 7147836SJohn.Forte@Sun.COM InitLibrary(); 7157836SJohn.Forte@Sun.COM 7167836SJohn.Forte@Sun.COM if (pProps == NULL) 7177836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 7187836SJohn.Forte@Sun.COM 7197836SJohn.Forte@Sun.COM // Fill in the library properties. 7207836SJohn.Forte@Sun.COM GetBuildTime(&pProps->buildTime); 7217836SJohn.Forte@Sun.COM pProps->supportedImaVersion = LIBRARY_PROPERTY_SUPPORTED_IMA_VERSION; 7227836SJohn.Forte@Sun.COM libSwprintf(pProps->implementationVersion, L"%ls", 7237836SJohn.Forte@Sun.COM LIBRARY_PROPERTY_IMPLEMENTATION_VERSION); 7247836SJohn.Forte@Sun.COM libSwprintf(pProps->vendor, L"%ls", LIBRARY_PROPERTY_VENDOR); 7257836SJohn.Forte@Sun.COM 7267836SJohn.Forte@Sun.COM 7277836SJohn.Forte@Sun.COM #ifdef WIN32 7287836SJohn.Forte@Sun.COM imaHandle = GetModuleHandleA("ima"); 7297836SJohn.Forte@Sun.COM imaPath[0] = 0; 7307836SJohn.Forte@Sun.COM if (imaHandle != NULL) { 7317836SJohn.Forte@Sun.COM GetModuleFileNameA(imaHandle, imaPath, 256); 7327836SJohn.Forte@Sun.COM } 7337836SJohn.Forte@Sun.COM MultiByteToWideChar(CP_ACP, 0, imaPath, -1, 7347836SJohn.Forte@Sun.COM pProps->fileName, 256); 7357836SJohn.Forte@Sun.COM #else 7367836SJohn.Forte@Sun.COM libSwprintf(pProps->fileName, LIBRARY_FILE_NAME); 7377836SJohn.Forte@Sun.COM 7387836SJohn.Forte@Sun.COM // mbstowcs(pProps->fileName, imaPath, 256); 7397836SJohn.Forte@Sun.COM #endif 7407836SJohn.Forte@Sun.COM 7417836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 7427836SJohn.Forte@Sun.COM } 7437836SJohn.Forte@Sun.COM 7447836SJohn.Forte@Sun.COM 7457836SJohn.Forte@Sun.COM /* 7467836SJohn.Forte@Sun.COM * Gets a list of the object IDs of all currently loaded plugins. 7477836SJohn.Forte@Sun.COM * 7487836SJohn.Forte@Sun.COM * @param ppList A pointer to a pointer to an @ref IMA_OID_LIST. 7497836SJohn.Forte@Sun.COM * On successful return this will contain a pointer to an @ref 7507836SJohn.Forte@Sun.COM * IMA_OID_LIST which contains the object IDs of all of the plugins 7517836SJohn.Forte@Sun.COM * currently loaded by the library. 7527836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful 7537836SJohn.Forte@Sun.COM * or if an error occurred. 7547836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the plugin ID list was successfully 7557836SJohn.Forte@Sun.COM * returned. 7567836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or 7577836SJohn.Forte@Sun.COM * specifies a memory area to which data cannot be written. 7587836SJohn.Forte@Sun.COM */ 7597836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPluginOidList( 7607836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 7617836SJohn.Forte@Sun.COM IMA_UINT i; 7627836SJohn.Forte@Sun.COM 7637836SJohn.Forte@Sun.COM 7647836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 7657836SJohn.Forte@Sun.COM InitLibrary(); 7667836SJohn.Forte@Sun.COM 7677836SJohn.Forte@Sun.COM if (ppList == NULL) 7687836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 7697836SJohn.Forte@Sun.COM 7707836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 7717836SJohn.Forte@Sun.COM 7727836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + 7737836SJohn.Forte@Sun.COM (number_of_plugins - 1) * sizeof (IMA_OID)); 7747836SJohn.Forte@Sun.COM 7757836SJohn.Forte@Sun.COM if ((*ppList) == NULL) 7767836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 7777836SJohn.Forte@Sun.COM 7787836SJohn.Forte@Sun.COM (*ppList)->oidCount = number_of_plugins; 7797836SJohn.Forte@Sun.COM 7807836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 7817836SJohn.Forte@Sun.COM 7827836SJohn.Forte@Sun.COM (*ppList)->oids[i].objectType = IMA_OBJECT_TYPE_PLUGIN; 7837836SJohn.Forte@Sun.COM (*ppList)->oids[i].ownerId = plugintable[i].ownerId; 7847836SJohn.Forte@Sun.COM (*ppList)->oids[i].objectSequenceNumber = 0; 7857836SJohn.Forte@Sun.COM 7867836SJohn.Forte@Sun.COM } 7877836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 7887836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 7897836SJohn.Forte@Sun.COM } 7907836SJohn.Forte@Sun.COM 7917836SJohn.Forte@Sun.COM 7927836SJohn.Forte@Sun.COM 7937836SJohn.Forte@Sun.COM 7947836SJohn.Forte@Sun.COM /* 7957836SJohn.Forte@Sun.COM * Gets the properties of the specified vendor plugin. 7967836SJohn.Forte@Sun.COM * 7977836SJohn.Forte@Sun.COM * @param pluginId The ID of the plugin whose properties are being retrieved. 7987836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref IMA_PLUGIN_PROPERTIES structure 7997836SJohn.Forte@Sun.COM * allocated by the caller. On successful return this will contain the 8007836SJohn.Forte@Sun.COM * properties of the plugin specified by pluginId. 8017836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 8027836SJohn.Forte@Sun.COM * an error occurred. 8037836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the plugin properties were successfully 8047836SJohn.Forte@Sun.COM * returned. 8057836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a pluginId does not 8067836SJohn.Forte@Sun.COM * specify any valid object type. 8077836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a pluginId does not 8087836SJohn.Forte@Sun.COM * specify a plugin object. 8097836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a pluginId refers to a 8107836SJohn.Forte@Sun.COM * plugin, but not one that is currently loaded. 8117836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL or 8127836SJohn.Forte@Sun.COM * specify a memory area to which data cannot be written. 8137836SJohn.Forte@Sun.COM */ 8147836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPluginProperties( 8157836SJohn.Forte@Sun.COM IMA_OID pluginOid, 8167836SJohn.Forte@Sun.COM IMA_PLUGIN_PROPERTIES *pProps) { 8177836SJohn.Forte@Sun.COM IMA_GetPluginPropertiesFn PassFunc; 8187836SJohn.Forte@Sun.COM IMA_UINT i; 8197836SJohn.Forte@Sun.COM IMA_STATUS status; 8207836SJohn.Forte@Sun.COM 8217836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 8227836SJohn.Forte@Sun.COM InitLibrary(); 8237836SJohn.Forte@Sun.COM 8247836SJohn.Forte@Sun.COM if (pProps == NULL) 8257836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 8267836SJohn.Forte@Sun.COM 8277836SJohn.Forte@Sun.COM if ((pluginOid.objectType != IMA_OBJECT_TYPE_PLUGIN) || 8287836SJohn.Forte@Sun.COM (pluginOid.objectSequenceNumber != 0)) 8297836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 8307836SJohn.Forte@Sun.COM 8317836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 8327836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 8337836SJohn.Forte@Sun.COM 8347836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 8357836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == pluginOid.ownerId) { 8367836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 8377836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 8387836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 8397836SJohn.Forte@Sun.COM #ifdef WIN32 8407836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPluginPropertiesFn) 8417836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 8427836SJohn.Forte@Sun.COM "IMA_GetPluginProperties"); 8437836SJohn.Forte@Sun.COM #else 8447836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPluginPropertiesFn) 8457836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 8467836SJohn.Forte@Sun.COM "IMA_GetPluginProperties"); 8477836SJohn.Forte@Sun.COM #endif 8487836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 8497836SJohn.Forte@Sun.COM status = PassFunc(pluginOid, pProps); 8507836SJohn.Forte@Sun.COM } 8517836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 8527836SJohn.Forte@Sun.COM } 8537836SJohn.Forte@Sun.COM 8547836SJohn.Forte@Sun.COM break; 8557836SJohn.Forte@Sun.COM } 8567836SJohn.Forte@Sun.COM } 8577836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 8587836SJohn.Forte@Sun.COM return (status); 8597836SJohn.Forte@Sun.COM 8607836SJohn.Forte@Sun.COM } 8617836SJohn.Forte@Sun.COM 8627836SJohn.Forte@Sun.COM 8637836SJohn.Forte@Sun.COM 8647836SJohn.Forte@Sun.COM 8657836SJohn.Forte@Sun.COM /* 8667836SJohn.Forte@Sun.COM * Gets the object ID for the plugin associated with the specified object ID. 8677836SJohn.Forte@Sun.COM * 8687836SJohn.Forte@Sun.COM * @param objectId The object ID of an object that has been received from 8697836SJohn.Forte@Sun.COM * a previous library call. 8707836SJohn.Forte@Sun.COM * @param pPluginId A pointer to an @ref IMA_OID structure allocated by the 8717836SJohn.Forte@Sun.COM * caller. On successful return this will contain the object ID of the 8727836SJohn.Forte@Sun.COM * plugin associated with the object specified by @a objectId. This 8737836SJohn.Forte@Sun.COM * can then be used to work with the plugin, e.g., to get the 8747836SJohn.Forte@Sun.COM * properties of the plugin or the send the plugin an IOCtl. 8757836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 8767836SJohn.Forte@Sun.COM * an error occurred. 8777836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the associated plugin ID was 8787836SJohn.Forte@Sun.COM * successfully returned. 8797836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pPluginId is NULL 8807836SJohn.Forte@Sun.COM * or specifes a memory area to which data cannot be written. 8817836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a objectId specifies 8827836SJohn.Forte@Sun.COM * an object not owned by a plugin, but instead one that is owned by 8837836SJohn.Forte@Sun.COM * the library. 8847836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a objectId specifies 8857836SJohn.Forte@Sun.COM * an object with an invalid type. 8867836SJohn.Forte@Sun.COM */ 8877836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetAssociatedPluginOid( 8887836SJohn.Forte@Sun.COM IMA_OID objectId, 8897836SJohn.Forte@Sun.COM IMA_OID *pPluginId) { 8907836SJohn.Forte@Sun.COM IMA_UINT i; 8917836SJohn.Forte@Sun.COM IMA_STATUS status; 8927836SJohn.Forte@Sun.COM 8937836SJohn.Forte@Sun.COM 8947836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 8957836SJohn.Forte@Sun.COM InitLibrary(); 8967836SJohn.Forte@Sun.COM 8977836SJohn.Forte@Sun.COM if (pPluginId == NULL || objectId.ownerId == RL_LIBRARY_SEQNUM) 8987836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 8997836SJohn.Forte@Sun.COM 9007836SJohn.Forte@Sun.COM if (objectId.objectType != IMA_OBJECT_TYPE_UNKNOWN && 9017836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_PLUGIN && 9027836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_NODE && 9037836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_LHBA && 9047836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_PHBA && 9057836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL && 9067836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_PORTAL_GROUP && 9077836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_LNP && 9087836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_PNP && 9097836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_TARGET && 9107836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_LU && 9117836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_DISCOVERY_ADDRESS && 9127836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET) 9137836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_OBJECT_TYPE); 9147836SJohn.Forte@Sun.COM 9157836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 9167836SJohn.Forte@Sun.COM 9177836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 9187836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 9197836SJohn.Forte@Sun.COM if (objectId.ownerId == plugintable[i].ownerId) { 9207836SJohn.Forte@Sun.COM pPluginId->objectType = IMA_OBJECT_TYPE_PLUGIN; 9217836SJohn.Forte@Sun.COM pPluginId->ownerId = plugintable[i].ownerId; 9227836SJohn.Forte@Sun.COM pPluginId->objectSequenceNumber = 0; 9237836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 9247836SJohn.Forte@Sun.COM } 9257836SJohn.Forte@Sun.COM 9267836SJohn.Forte@Sun.COM } 9277836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 9287836SJohn.Forte@Sun.COM return (status); 9297836SJohn.Forte@Sun.COM } 9307836SJohn.Forte@Sun.COM 9317836SJohn.Forte@Sun.COM 9327836SJohn.Forte@Sun.COM 9337836SJohn.Forte@Sun.COM 9347836SJohn.Forte@Sun.COM /* 9357836SJohn.Forte@Sun.COM * Gets the object ID of the shared node. 9367836SJohn.Forte@Sun.COM * 9377836SJohn.Forte@Sun.COM * @param pSharedNodeId A pointer to an @ref IMA_OID structure allocated by 9387836SJohn.Forte@Sun.COM * the caller. On successful return it will contain the object ID of the 9397836SJohn.Forte@Sun.COM * shared node of the currently executing system is placed. 9407836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 9417836SJohn.Forte@Sun.COM * an error occurred. 9427836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the shared node ID has been successfully 9437836SJohn.Forte@Sun.COM * retrieved. 9447836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pSharedNodeId is NULL 9457836SJohn.Forte@Sun.COM * or specifies a memory area to which data cannot be written. 9467836SJohn.Forte@Sun.COM */ 9477836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetSharedNodeOid( 9487836SJohn.Forte@Sun.COM IMA_OID *pSharedNodeId) { 9497836SJohn.Forte@Sun.COM if (pSharedNodeId == NULL) 9507836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 9517836SJohn.Forte@Sun.COM 9527836SJohn.Forte@Sun.COM pSharedNodeId->objectType = IMA_OBJECT_TYPE_NODE; 9537836SJohn.Forte@Sun.COM pSharedNodeId->ownerId = RL_LIBRARY_SEQNUM; 9547836SJohn.Forte@Sun.COM pSharedNodeId->objectSequenceNumber = RL_SHARED_NODE_SEQNUM; 9557836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 9567836SJohn.Forte@Sun.COM } 9577836SJohn.Forte@Sun.COM 9587836SJohn.Forte@Sun.COM 9597836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetObjectType( 9607836SJohn.Forte@Sun.COM IMA_OID oid, 9617836SJohn.Forte@Sun.COM IMA_OBJECT_TYPE *pObjectType) { 9627836SJohn.Forte@Sun.COM IMA_STATUS status; 9637836SJohn.Forte@Sun.COM IMA_UINT i; 9647836SJohn.Forte@Sun.COM 9657836SJohn.Forte@Sun.COM if (pObjectType == NULL) 9667836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 9677836SJohn.Forte@Sun.COM 9687836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_UNKNOWN && 9697836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PLUGIN && 9707836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_NODE && 9717836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_LHBA && 9727836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PHBA && 9737836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL && 9747836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PORTAL_GROUP && 9757836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_LNP && 9767836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PNP && 9777836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_TARGET && 9787836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_LU && 9797836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_DISCOVERY_ADDRESS && 9807836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET) 9817836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_OBJECT_TYPE); 9827836SJohn.Forte@Sun.COM 9837836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 9847836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 9857836SJohn.Forte@Sun.COM 9867836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 9877836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 9887836SJohn.Forte@Sun.COM *pObjectType = oid.objectType; 9897836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 9907836SJohn.Forte@Sun.COM } 9917836SJohn.Forte@Sun.COM } 9927836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 9937836SJohn.Forte@Sun.COM return (status); 9947836SJohn.Forte@Sun.COM } 9957836SJohn.Forte@Sun.COM 9967836SJohn.Forte@Sun.COM 9977836SJohn.Forte@Sun.COM 9987836SJohn.Forte@Sun.COM /* 9997836SJohn.Forte@Sun.COM * Gets the properties of the specified iSCSI node. 10007836SJohn.Forte@Sun.COM * @param nodeId The ID of the node to get the properties of. 10017836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref IMA_NODE_PROPERTIES structure 10027836SJohn.Forte@Sun.COM * which on successfully return 10037836SJohn.Forte@Sun.COM * will contain the properties of the specified node. 10047836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or 10057836SJohn.Forte@Sun.COM * if an error occurred. 10067836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the node properties have been 10077836SJohn.Forte@Sun.COM * successfully retrieved. 10087836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL 10097836SJohn.Forte@Sun.COM * or specifies a memory area to which data cannot be written. 10107836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a nodeId does 10117836SJohn.Forte@Sun.COM * not specify any valid object type. 10127836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a nodeId does 10137836SJohn.Forte@Sun.COM * not specify a node object. 10147836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a nodeId does not 10157836SJohn.Forte@Sun.COM * specify a node which is currently known to the system. 10167836SJohn.Forte@Sun.COM */ 10177836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetNodeProperties( 10187836SJohn.Forte@Sun.COM IMA_OID nodeOid, 10197836SJohn.Forte@Sun.COM IMA_NODE_PROPERTIES *pProps) { 10207836SJohn.Forte@Sun.COM IMA_GetNodePropertiesFn PassFunc; 10217836SJohn.Forte@Sun.COM IMA_UINT i; 10227836SJohn.Forte@Sun.COM IMA_STATUS status; 10237836SJohn.Forte@Sun.COM char fullline[512]; /* Full line read in from IMA.conf */ 10247836SJohn.Forte@Sun.COM char nodename[256]; 10257836SJohn.Forte@Sun.COM IMA_UINT dwStrLength; 10267836SJohn.Forte@Sun.COM 10277836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 10287836SJohn.Forte@Sun.COM InitLibrary(); 10297836SJohn.Forte@Sun.COM 10307836SJohn.Forte@Sun.COM if (pProps == NULL) 10317836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 10327836SJohn.Forte@Sun.COM 10337836SJohn.Forte@Sun.COM if (nodeOid.objectType != IMA_OBJECT_TYPE_NODE) 10347836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 10357836SJohn.Forte@Sun.COM 10367836SJohn.Forte@Sun.COM if ((nodeOid.ownerId == RL_LIBRARY_SEQNUM) && 10377836SJohn.Forte@Sun.COM (nodeOid.objectSequenceNumber == RL_SHARED_NODE_SEQNUM)) { 10387836SJohn.Forte@Sun.COM pProps->runningInInitiatorMode = IMA_TRUE; 10397836SJohn.Forte@Sun.COM pProps->runningInTargetMode = IMA_TRUE; 10407836SJohn.Forte@Sun.COM pProps->nameAndAliasSettable = IMA_TRUE; 10417836SJohn.Forte@Sun.COM 10427836SJohn.Forte@Sun.COM if (sharedNodeName[0] == 0) { 10437836SJohn.Forte@Sun.COM #if defined(_WINDOWS) 10447836SJohn.Forte@Sun.COM GetComputerName((char *)fullline, 10457836SJohn.Forte@Sun.COM (LPDWORD)&dwStrLength); 10467836SJohn.Forte@Sun.COM sprintf(nodename, DEFAULT_NODE_NAME_FORMAT, fullline); 10477836SJohn.Forte@Sun.COM MultiByteToWideChar(CP_ACP, 0, nodename, -1, 10487836SJohn.Forte@Sun.COM sharedNodeName, 256); 10497836SJohn.Forte@Sun.COM #elif defined(SOLARIS) 10507836SJohn.Forte@Sun.COM 10517836SJohn.Forte@Sun.COM if (getSolarisSharedNodeName(sharedNodeName) != 10527836SJohn.Forte@Sun.COM IMA_STATUS_SUCCESS) { 10537836SJohn.Forte@Sun.COM gethostname((char *)fullline, &dwStrLength); 10547836SJohn.Forte@Sun.COM sprintf(nodename, 10557836SJohn.Forte@Sun.COM DEFAULT_NODE_NAME_FORMAT, fullline); 10567836SJohn.Forte@Sun.COM mbstowcs(sharedNodeName, nodename, 256); 10577836SJohn.Forte@Sun.COM } 10587836SJohn.Forte@Sun.COM #else 10597836SJohn.Forte@Sun.COM gethostname((char *)fullline, &dwStrLength); 10607836SJohn.Forte@Sun.COM sprintf(nodename, DEFAULT_NODE_NAME_FORMAT, fullline); 10617836SJohn.Forte@Sun.COM mbstowcs(sharedNodeName, nodename, 256); 10627836SJohn.Forte@Sun.COM #endif 10637836SJohn.Forte@Sun.COM } 10647836SJohn.Forte@Sun.COM 10657836SJohn.Forte@Sun.COM if (sharedNodeName[0] != 0) { 10667836SJohn.Forte@Sun.COM libSwprintf(pProps->name, L"%ls", sharedNodeName); 10677836SJohn.Forte@Sun.COM pProps->nameValid = IMA_TRUE; 10687836SJohn.Forte@Sun.COM } 10697836SJohn.Forte@Sun.COM else 10707836SJohn.Forte@Sun.COM pProps->nameValid = IMA_FALSE; 10717836SJohn.Forte@Sun.COM 10727836SJohn.Forte@Sun.COM #if defined(SOLARIS) 10737836SJohn.Forte@Sun.COM if (sharedNodeAlias[0] == 0) { 10747836SJohn.Forte@Sun.COM getSolarisSharedNodeAlias(sharedNodeAlias); 10757836SJohn.Forte@Sun.COM } 10767836SJohn.Forte@Sun.COM #endif 10777836SJohn.Forte@Sun.COM 10787836SJohn.Forte@Sun.COM if (sharedNodeAlias[0] != 0) { 10797836SJohn.Forte@Sun.COM libSwprintf(pProps->alias, L"%ls", sharedNodeAlias); 10807836SJohn.Forte@Sun.COM pProps->aliasValid = IMA_TRUE; 10817836SJohn.Forte@Sun.COM } 10827836SJohn.Forte@Sun.COM else 10837836SJohn.Forte@Sun.COM pProps->aliasValid = IMA_FALSE; 10847836SJohn.Forte@Sun.COM 10857836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 10867836SJohn.Forte@Sun.COM } 10877836SJohn.Forte@Sun.COM 10887836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 10897836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 10907836SJohn.Forte@Sun.COM 10917836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 10927836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == nodeOid.ownerId) { 10937836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 10947836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 10957836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 10967836SJohn.Forte@Sun.COM #ifdef WIN32 10977836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNodePropertiesFn) 10987836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 10997836SJohn.Forte@Sun.COM "IMA_GetNodeProperties"); 11007836SJohn.Forte@Sun.COM #else 11017836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNodePropertiesFn) 11027836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 11037836SJohn.Forte@Sun.COM "IMA_GetNodeProperties"); 11047836SJohn.Forte@Sun.COM #endif 11057836SJohn.Forte@Sun.COM 11067836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 11077836SJohn.Forte@Sun.COM status = PassFunc(nodeOid, pProps); 11087836SJohn.Forte@Sun.COM } 11097836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 11107836SJohn.Forte@Sun.COM } 11117836SJohn.Forte@Sun.COM 11127836SJohn.Forte@Sun.COM break; 11137836SJohn.Forte@Sun.COM } 11147836SJohn.Forte@Sun.COM } 11157836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 11167836SJohn.Forte@Sun.COM return (status); 11177836SJohn.Forte@Sun.COM 11187836SJohn.Forte@Sun.COM } 11197836SJohn.Forte@Sun.COM 11207836SJohn.Forte@Sun.COM 11217836SJohn.Forte@Sun.COM 11227836SJohn.Forte@Sun.COM 11237836SJohn.Forte@Sun.COM /* 11247836SJohn.Forte@Sun.COM * Sets the name of the specified node. 11257836SJohn.Forte@Sun.COM * 11267836SJohn.Forte@Sun.COM * @param nodeId The object ID of the node whose name is being set. 11277836SJohn.Forte@Sun.COM * @param newName The new name of the node. 11287836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 11297836SJohn.Forte@Sun.COM * an error occurred. 11307836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the node name was successfully changed. 11317836SJohn.Forte@Sun.COM * @retval IMA_STATUS_REBOOT_NECESSARY Returned if a reboot is necessary 11327836SJohn.Forte@Sun.COM * before the setting of the name actually takes affect. 11337836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a newname is NULL, or 11347836SJohn.Forte@Sun.COM * specifies a memory area to which data cannot be written, or has a 11357836SJohn.Forte@Sun.COM * length of 0. 11367836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a nodeId does not 11377836SJohn.Forte@Sun.COM * specify any valid object type. 11387836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a nodeId does not 11397836SJohn.Forte@Sun.COM * specify a node object. 11407836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a nodeId does not specify a 11417836SJohn.Forte@Sun.COM * node which is currently known to the system. 11427836SJohn.Forte@Sun.COM * @retval IMA_ERROR_NAME_TOO_LONG Returned if @a newName contains too many 11437836SJohn.Forte@Sun.COM * characters. 11447836SJohn.Forte@Sun.COM */ 11457836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetNodeName( 11467836SJohn.Forte@Sun.COM IMA_OID nodeOid, 11477836SJohn.Forte@Sun.COM const IMA_NODE_NAME newName) { 11487836SJohn.Forte@Sun.COM IMA_SetNodeNameFn PassFunc; 11497836SJohn.Forte@Sun.COM IMA_UINT i; 11507836SJohn.Forte@Sun.COM IMA_STATUS status; 11517836SJohn.Forte@Sun.COM 11527836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 11537836SJohn.Forte@Sun.COM InitLibrary(); 11547836SJohn.Forte@Sun.COM 11557836SJohn.Forte@Sun.COM if (newName == NULL || wcslen(newName) == 0) 11567836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 11577836SJohn.Forte@Sun.COM 11587836SJohn.Forte@Sun.COM if (wcslen(newName) > IMA_NODE_NAME_LEN - 1) 11597836SJohn.Forte@Sun.COM return (IMA_ERROR_NAME_TOO_LONG); 11607836SJohn.Forte@Sun.COM 11617836SJohn.Forte@Sun.COM if (nodeOid.objectType != IMA_OBJECT_TYPE_NODE) 11627836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 11637836SJohn.Forte@Sun.COM 11647836SJohn.Forte@Sun.COM if ((nodeOid.ownerId == RL_LIBRARY_SEQNUM) && 11657836SJohn.Forte@Sun.COM (nodeOid.objectSequenceNumber == RL_SHARED_NODE_SEQNUM)) { 11667836SJohn.Forte@Sun.COM #if defined(SOLARIS) 11677836SJohn.Forte@Sun.COM if (setSolarisSharedNodeName(newName) != IMA_STATUS_SUCCESS) { 11687836SJohn.Forte@Sun.COM return (IMA_ERROR_UNKNOWN_ERROR); 11697836SJohn.Forte@Sun.COM } 11707836SJohn.Forte@Sun.COM #endif 11717836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 11727836SJohn.Forte@Sun.COM libSwprintf(sharedNodeName, L"%ls", newName); 11737836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 11747836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 11757836SJohn.Forte@Sun.COM } 11767836SJohn.Forte@Sun.COM 11777836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 11787836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 11797836SJohn.Forte@Sun.COM 11807836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 11817836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == nodeOid.ownerId) { 11827836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 11837836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 11847836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 11857836SJohn.Forte@Sun.COM #ifdef WIN32 11867836SJohn.Forte@Sun.COM PassFunc = (IMA_SetNodeNameFn) 11877836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 11887836SJohn.Forte@Sun.COM "IMA_SetNodeName"); 11897836SJohn.Forte@Sun.COM #else 11907836SJohn.Forte@Sun.COM PassFunc = (IMA_SetNodeNameFn) 11917836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 11927836SJohn.Forte@Sun.COM "IMA_SetNodeName"); 11937836SJohn.Forte@Sun.COM #endif 11947836SJohn.Forte@Sun.COM 11957836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 11967836SJohn.Forte@Sun.COM status = PassFunc(nodeOid, newName); 11977836SJohn.Forte@Sun.COM } 11987836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 11997836SJohn.Forte@Sun.COM } 12007836SJohn.Forte@Sun.COM 12017836SJohn.Forte@Sun.COM break; 12027836SJohn.Forte@Sun.COM } 12037836SJohn.Forte@Sun.COM } 12047836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 12057836SJohn.Forte@Sun.COM return (status); 12067836SJohn.Forte@Sun.COM 12077836SJohn.Forte@Sun.COM } 12087836SJohn.Forte@Sun.COM 12097836SJohn.Forte@Sun.COM 12107836SJohn.Forte@Sun.COM 12117836SJohn.Forte@Sun.COM 12127836SJohn.Forte@Sun.COM /* 12137836SJohn.Forte@Sun.COM * Generates an unique node name for the currently running system. 12147836SJohn.Forte@Sun.COM * 12157836SJohn.Forte@Sun.COM * @param generatedname On successful return contains the generated node 12167836SJohn.Forte@Sun.COM * name. 12177836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 12187836SJohn.Forte@Sun.COM * an error occurred. 12197836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a generatedname is NULL 12207836SJohn.Forte@Sun.COM * or specifies a memory area to which data cannot be written. 12217836SJohn.Forte@Sun.COM */ 12227836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GenerateNodeName( 12237836SJohn.Forte@Sun.COM IMA_NODE_NAME generatedname) { 12247836SJohn.Forte@Sun.COM char computername[256]; 12257836SJohn.Forte@Sun.COM char nodename[256]; 12267836SJohn.Forte@Sun.COM IMA_UINT dwStrLength; 12277836SJohn.Forte@Sun.COM #ifndef _WINDOWS 12287836SJohn.Forte@Sun.COM #ifndef SOLARIS 12297836SJohn.Forte@Sun.COM int i; 12307836SJohn.Forte@Sun.COM #endif 12317836SJohn.Forte@Sun.COM #endif 12327836SJohn.Forte@Sun.COM 12337836SJohn.Forte@Sun.COM dwStrLength = 255; 12347836SJohn.Forte@Sun.COM 12357836SJohn.Forte@Sun.COM if (generatedname == NULL) 12367836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 12377836SJohn.Forte@Sun.COM 12387836SJohn.Forte@Sun.COM #if defined(_WINDOWS) 12397836SJohn.Forte@Sun.COM GetComputerName((char *)computername, (LPDWORD)&dwStrLength); 12407836SJohn.Forte@Sun.COM _strlwr(computername); 12417836SJohn.Forte@Sun.COM _snprintf(nodename, 256, DEFAULT_NODE_NAME_FORMAT, computername); 12427836SJohn.Forte@Sun.COM MultiByteToWideChar(CP_ACP, 0, nodename, -1, 12437836SJohn.Forte@Sun.COM generatedname, 256); 12447836SJohn.Forte@Sun.COM #elif defined(SOLARIS) 12457836SJohn.Forte@Sun.COM if (getSolarisSharedNodeName(generatedname) != IMA_STATUS_SUCCESS) { 12467836SJohn.Forte@Sun.COM gethostname(computername, &dwStrLength); 12477836SJohn.Forte@Sun.COM sprintf(nodename, DEFAULT_NODE_NAME_FORMAT, generatedname); 12487836SJohn.Forte@Sun.COM mbstowcs(generatedname, nodename, 256); 12497836SJohn.Forte@Sun.COM } 12507836SJohn.Forte@Sun.COM #else 12517836SJohn.Forte@Sun.COM gethostname((char *)computername, &dwStrLength); 12527836SJohn.Forte@Sun.COM i = 0; 12537836SJohn.Forte@Sun.COM while (computername[i] != '\0') { 12547836SJohn.Forte@Sun.COM computername[i] = tolower(computername[i]); 12557836SJohn.Forte@Sun.COM i++; 12567836SJohn.Forte@Sun.COM } 12577836SJohn.Forte@Sun.COM snprintf(nodename, 256, DEFAULT_NODE_NAME_FORMAT, computername); 12587836SJohn.Forte@Sun.COM mbstowcs(generatedname, nodename, 256); 12597836SJohn.Forte@Sun.COM #endif 12607836SJohn.Forte@Sun.COM 12617836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 12627836SJohn.Forte@Sun.COM } 12637836SJohn.Forte@Sun.COM 12647836SJohn.Forte@Sun.COM 12657836SJohn.Forte@Sun.COM /* 12667836SJohn.Forte@Sun.COM * Sets the alias of the specified node. 12677836SJohn.Forte@Sun.COM * 12687836SJohn.Forte@Sun.COM * @param nodeId The object ID of the node whose alias is being set. 12697836SJohn.Forte@Sun.COM * @param newAlias A pointer to a Unicode string which contains the new node 12707836SJohn.Forte@Sun.COM * alias.If this parameter is NULL then the current alias is deleted, in 12717836SJohn.Forte@Sun.COM * which case the specified node no longer has an alias. 12727836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 12737836SJohn.Forte@Sun.COM * an error occurred. 12747836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the node's alias has been successfully set. 12757836SJohn.Forte@Sun.COM * @retval IMA_STATUS_REBOOT_NECESSARY A reboot is necessary before 12767836SJohn.Forte@Sun.COM * the setting of the 12777836SJohn.Forte@Sun.COM * alias actually takes affect. 12787836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a nodeId does not 12797836SJohn.Forte@Sun.COM * specify any valid object type. 12807836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a nodeId does not 12817836SJohn.Forte@Sun.COM * specify a node object. 12827836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a nodeId does not specify 12837836SJohn.Forte@Sun.COM * a node which is currently known to the system. 12847836SJohn.Forte@Sun.COM * @retval IMA_ERROR_NAME_TOO_LONG Returned if @a newAlias contains too many 12857836SJohn.Forte@Sun.COM * characters. 12867836SJohn.Forte@Sun.COM */ 12877836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetNodeAlias( 12887836SJohn.Forte@Sun.COM IMA_OID nodeOid, 12897836SJohn.Forte@Sun.COM const IMA_NODE_ALIAS newAlias) { 12907836SJohn.Forte@Sun.COM IMA_SetNodeAliasFn PassFunc; 12917836SJohn.Forte@Sun.COM IMA_UINT i; 12927836SJohn.Forte@Sun.COM IMA_STATUS status; 12937836SJohn.Forte@Sun.COM 12947836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 12957836SJohn.Forte@Sun.COM InitLibrary(); 12967836SJohn.Forte@Sun.COM 12977836SJohn.Forte@Sun.COM if (newAlias == NULL) 12987836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 12997836SJohn.Forte@Sun.COM 13007836SJohn.Forte@Sun.COM if (wcslen(newAlias) > IMA_NODE_ALIAS_LEN - 1) 13017836SJohn.Forte@Sun.COM return (IMA_ERROR_NAME_TOO_LONG); 13027836SJohn.Forte@Sun.COM 13037836SJohn.Forte@Sun.COM if (nodeOid.objectType != IMA_OBJECT_TYPE_NODE) 13047836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 13057836SJohn.Forte@Sun.COM 13067836SJohn.Forte@Sun.COM if ((nodeOid.ownerId == RL_LIBRARY_SEQNUM) && 13077836SJohn.Forte@Sun.COM (nodeOid.objectSequenceNumber == RL_SHARED_NODE_SEQNUM)) { 13087836SJohn.Forte@Sun.COM #if defined(SOLARIS) 13097836SJohn.Forte@Sun.COM if (setSolarisSharedNodeAlias(newAlias) != IMA_STATUS_SUCCESS) { 13107836SJohn.Forte@Sun.COM return (IMA_ERROR_UNKNOWN_ERROR); 13117836SJohn.Forte@Sun.COM } 13127836SJohn.Forte@Sun.COM #endif 13137836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 13147836SJohn.Forte@Sun.COM if (wcslen(newAlias) > 0 && newAlias != NULL) 13157836SJohn.Forte@Sun.COM libSwprintf(sharedNodeAlias, L"%ls", newAlias); 13167836SJohn.Forte@Sun.COM else 13177836SJohn.Forte@Sun.COM libSwprintf(sharedNodeAlias, L"%ls", ""); 13187836SJohn.Forte@Sun.COM 13197836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 13207836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 13217836SJohn.Forte@Sun.COM } 13227836SJohn.Forte@Sun.COM 13237836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 13247836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 13257836SJohn.Forte@Sun.COM 13267836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 13277836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == nodeOid.ownerId) { 13287836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 13297836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 13307836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 13317836SJohn.Forte@Sun.COM #ifdef WIN32 13327836SJohn.Forte@Sun.COM PassFunc = (IMA_SetNodeAliasFn) 13337836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 13347836SJohn.Forte@Sun.COM "IMA_SetNodeAlias"); 13357836SJohn.Forte@Sun.COM #else 13367836SJohn.Forte@Sun.COM PassFunc = (IMA_SetNodeAliasFn) 13377836SJohn.Forte@Sun.COM dlsym( 13387836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 13397836SJohn.Forte@Sun.COM "IMA_SetNodeAlias"); 13407836SJohn.Forte@Sun.COM #endif 13417836SJohn.Forte@Sun.COM 13427836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 13437836SJohn.Forte@Sun.COM status = PassFunc(nodeOid, newAlias); 13447836SJohn.Forte@Sun.COM } 13457836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 13467836SJohn.Forte@Sun.COM } 13477836SJohn.Forte@Sun.COM 13487836SJohn.Forte@Sun.COM break; 13497836SJohn.Forte@Sun.COM } 13507836SJohn.Forte@Sun.COM } 13517836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 13527836SJohn.Forte@Sun.COM return (status); 13537836SJohn.Forte@Sun.COM } 13547836SJohn.Forte@Sun.COM 13557836SJohn.Forte@Sun.COM 13567836SJohn.Forte@Sun.COM 13577836SJohn.Forte@Sun.COM 13587836SJohn.Forte@Sun.COM /* 13597836SJohn.Forte@Sun.COM * Gets a list of the object IDs of all the logical HBAs in the system. 13607836SJohn.Forte@Sun.COM * 13617836SJohn.Forte@Sun.COM * @param ppList A pointer to a pointer to an @ref IMA_OID_LIST structure. 13627836SJohn.Forte@Sun.COM * on successful return this will contain a pointer to an 13637836SJohn.Forte@Sun.COM * @ref IMA_OID_LIST which contains the object IDs of all of the 13647836SJohn.Forte@Sun.COM * LHBAs currently in the system. 13657836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 13667836SJohn.Forte@Sun.COM * an error occurred. 13677836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the LHBA ID list has been successfully 13687836SJohn.Forte@Sun.COM * returned. 13697836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or 13707836SJohn.Forte@Sun.COM * specifies a 13717836SJohn.Forte@Sun.COM * memory area to which data cannot be written. 13727836SJohn.Forte@Sun.COM */ 13737836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLhbaOidList( 13747836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 13757836SJohn.Forte@Sun.COM IMA_GetLhbaOidListFn PassFunc; 13767836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 13777836SJohn.Forte@Sun.COM 13787836SJohn.Forte@Sun.COM IMA_UINT i; 13797836SJohn.Forte@Sun.COM IMA_UINT j; 13807836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 13817836SJohn.Forte@Sun.COM IMA_STATUS status; 13827836SJohn.Forte@Sun.COM 13837836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 13847836SJohn.Forte@Sun.COM InitLibrary(); 13857836SJohn.Forte@Sun.COM 13867836SJohn.Forte@Sun.COM if (ppList == NULL) 13877836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 13887836SJohn.Forte@Sun.COM 13897836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 13907836SJohn.Forte@Sun.COM // Get total id count first 13917836SJohn.Forte@Sun.COM totalIdCount = 0; 13927836SJohn.Forte@Sun.COM 13937836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 13947836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 13957836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 13967836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 13977836SJohn.Forte@Sun.COM #ifdef WIN32 13987836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLhbaOidListFn) 13997836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 14007836SJohn.Forte@Sun.COM "IMA_GetLhbaOidList"); 14017836SJohn.Forte@Sun.COM #else 14027836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLhbaOidListFn) 14037836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 14047836SJohn.Forte@Sun.COM "IMA_GetLhbaOidList"); 14057836SJohn.Forte@Sun.COM #endif 14067836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 14077836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 14087836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 14097836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 14107836SJohn.Forte@Sun.COM totalIdCount += ppOidList->oidCount; 14117836SJohn.Forte@Sun.COM #ifdef WIN32 14127836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 14137836SJohn.Forte@Sun.COM GetProcAddress( 14147836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 14157836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 14167836SJohn.Forte@Sun.COM #else 14177836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 14187836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 14197836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 14207836SJohn.Forte@Sun.COM #endif 14217836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 14227836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 14237836SJohn.Forte@Sun.COM } 14247836SJohn.Forte@Sun.COM } 14257836SJohn.Forte@Sun.COM 14267836SJohn.Forte@Sun.COM } 14277836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 14287836SJohn.Forte@Sun.COM } 14297836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 14307836SJohn.Forte@Sun.COM break; 14317836SJohn.Forte@Sun.COM } 14327836SJohn.Forte@Sun.COM } 14337836SJohn.Forte@Sun.COM 14347836SJohn.Forte@Sun.COM 14357836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + 14367836SJohn.Forte@Sun.COM (totalIdCount - 1) * sizeof (IMA_OID)); 14377836SJohn.Forte@Sun.COM 14387836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 14397836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 14407836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 14417836SJohn.Forte@Sun.COM } 14427836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 14437836SJohn.Forte@Sun.COM 14447836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 14457836SJohn.Forte@Sun.COM totalIdCount = 0; 14467836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 14477836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 14487836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 14497836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 14507836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 14517836SJohn.Forte@Sun.COM #ifdef WIN32 14527836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLhbaOidListFn) 14537836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 14547836SJohn.Forte@Sun.COM "IMA_GetLhbaOidList"); 14557836SJohn.Forte@Sun.COM #else 14567836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLhbaOidListFn) 14577836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 14587836SJohn.Forte@Sun.COM "IMA_GetLhbaOidList"); 14597836SJohn.Forte@Sun.COM #endif 14607836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 14617836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 14627836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 14637836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 14647836SJohn.Forte@Sun.COM for (j = 0; 14657836SJohn.Forte@Sun.COM (j < ppOidList->oidCount) && 14667836SJohn.Forte@Sun.COM (totalIdCount < 14677836SJohn.Forte@Sun.COM (*ppList)->oidCount); 14687836SJohn.Forte@Sun.COM j++) { 14697836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 14707836SJohn.Forte@Sun.COM objectType 14717836SJohn.Forte@Sun.COM = ppOidList->oids[j]. 14727836SJohn.Forte@Sun.COM objectType; 14737836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 14747836SJohn.Forte@Sun.COM objectSequenceNumber = 14757836SJohn.Forte@Sun.COM ppOidList->oids[j]. 14767836SJohn.Forte@Sun.COM objectSequenceNumber; 14777836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 14787836SJohn.Forte@Sun.COM ownerId = 14797836SJohn.Forte@Sun.COM ppOidList->oids[j].ownerId; 14807836SJohn.Forte@Sun.COM totalIdCount++; 14817836SJohn.Forte@Sun.COM } 14827836SJohn.Forte@Sun.COM #ifdef WIN32 14837836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 14847836SJohn.Forte@Sun.COM GetProcAddress( 14857836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 14867836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 14877836SJohn.Forte@Sun.COM #else 14887836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 14897836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 14907836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 14917836SJohn.Forte@Sun.COM #endif 14927836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 14937836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 14947836SJohn.Forte@Sun.COM } 14957836SJohn.Forte@Sun.COM } 14967836SJohn.Forte@Sun.COM } 14977836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 14987836SJohn.Forte@Sun.COM } 14997836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 15007836SJohn.Forte@Sun.COM free(*ppList); 15017836SJohn.Forte@Sun.COM break; 15027836SJohn.Forte@Sun.COM } 15037836SJohn.Forte@Sun.COM 15047836SJohn.Forte@Sun.COM } 15057836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 15067836SJohn.Forte@Sun.COM return (status); 15077836SJohn.Forte@Sun.COM } 15087836SJohn.Forte@Sun.COM 15097836SJohn.Forte@Sun.COM 15107836SJohn.Forte@Sun.COM 15117836SJohn.Forte@Sun.COM 15127836SJohn.Forte@Sun.COM /* 15137836SJohn.Forte@Sun.COM * Gets the properties of the specified logical HBA. 15147836SJohn.Forte@Sun.COM * 15157836SJohn.Forte@Sun.COM * @param lhbaId The object ID of the LHBA whose properties are being 15167836SJohn.Forte@Sun.COM * retrieved. 15177836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref IMA_LHBA_PROPERTIES structure. 15187836SJohn.Forte@Sun.COM * On successful 15197836SJohn.Forte@Sun.COM * return this will contain the properties of the LHBA specified by 15207836SJohn.Forte@Sun.COM * @a lhbaId. 15217836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 15227836SJohn.Forte@Sun.COM * an error occurred. 15237836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the properties of the specified LHBA 15247836SJohn.Forte@Sun.COM * have been successfully retrieved. 15257836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL or 15267836SJohn.Forte@Sun.COM * specify a memory area to which data cannot be written. 15277836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a lhbaId does not 15287836SJohn.Forte@Sun.COM * specify any valid object type. 15297836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a lhbaId does not 15307836SJohn.Forte@Sun.COM * specify a LHBA. 15317836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a lhbaId does not 15327836SJohn.Forte@Sun.COM * specify a LHBA which is currently known to the system. 15337836SJohn.Forte@Sun.COM */ 15347836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLhbaProperties( 15357836SJohn.Forte@Sun.COM IMA_OID lhbaId, 15367836SJohn.Forte@Sun.COM IMA_LHBA_PROPERTIES *pProps) { 15377836SJohn.Forte@Sun.COM IMA_GetLhbaPropertiesFn PassFunc; 15387836SJohn.Forte@Sun.COM IMA_UINT i; 15397836SJohn.Forte@Sun.COM IMA_STATUS status; 15407836SJohn.Forte@Sun.COM 15417836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 15427836SJohn.Forte@Sun.COM InitLibrary(); 15437836SJohn.Forte@Sun.COM 15447836SJohn.Forte@Sun.COM if (pProps == NULL) 15457836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 15467836SJohn.Forte@Sun.COM 15477836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA) 15487836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 15497836SJohn.Forte@Sun.COM 15507836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 15517836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 15527836SJohn.Forte@Sun.COM 15537836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 15547836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 15557836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 15567836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 15577836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 15587836SJohn.Forte@Sun.COM #ifdef WIN32 15597836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLhbaPropertiesFn) 15607836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 15617836SJohn.Forte@Sun.COM "IMA_GetLhbaProperties"); 15627836SJohn.Forte@Sun.COM #else 15637836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLhbaPropertiesFn) 15647836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 15657836SJohn.Forte@Sun.COM "IMA_GetLhbaProperties"); 15667836SJohn.Forte@Sun.COM #endif 15677836SJohn.Forte@Sun.COM 15687836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 15697836SJohn.Forte@Sun.COM status = PassFunc(lhbaId, pProps); 15707836SJohn.Forte@Sun.COM } 15717836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 15727836SJohn.Forte@Sun.COM } 15737836SJohn.Forte@Sun.COM 15747836SJohn.Forte@Sun.COM break; 15757836SJohn.Forte@Sun.COM } 15767836SJohn.Forte@Sun.COM } 15777836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 15787836SJohn.Forte@Sun.COM return (status); 15797836SJohn.Forte@Sun.COM } 15807836SJohn.Forte@Sun.COM 15817836SJohn.Forte@Sun.COM 15827836SJohn.Forte@Sun.COM 15837836SJohn.Forte@Sun.COM 15847836SJohn.Forte@Sun.COM /* 15857836SJohn.Forte@Sun.COM * Gets a list of the object IDs of all the physical HBAs in the system. 15867836SJohn.Forte@Sun.COM * 15877836SJohn.Forte@Sun.COM * @param ppList A pointer to a pointer to an @ref IMA_OID_LIST structure. 15887836SJohn.Forte@Sun.COM * on successful return this will contain a pointer to an 15897836SJohn.Forte@Sun.COM * @ref IMA_OID_LIST which contains the object IDs of all of the 15907836SJohn.Forte@Sun.COM * PHBAs currently in the system. 15917836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 15927836SJohn.Forte@Sun.COM * an error occurred. 15937836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the PHBA ID list has been successfully 15947836SJohn.Forte@Sun.COM * returned. 15957836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or 15967836SJohn.Forte@Sun.COM * specify a memory area to which data cannot be written. 15977836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the properties of the specified PHBA 15987836SJohn.Forte@Sun.COM * have been successfully retrieved. 15997836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a phbaId does not 16007836SJohn.Forte@Sun.COM * specify a PHBA which is currently known to the system. 16017836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or 16027836SJohn.Forte@Sun.COM * specify a memory area to which data cannot be written. 16037836SJohn.Forte@Sun.COM */ 16047836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPhbaOidList( 16057836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 16067836SJohn.Forte@Sun.COM IMA_GetPhbaOidListFn PassFunc; 16077836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 16087836SJohn.Forte@Sun.COM 16097836SJohn.Forte@Sun.COM IMA_UINT i; 16107836SJohn.Forte@Sun.COM IMA_UINT j; 16117836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 16127836SJohn.Forte@Sun.COM IMA_STATUS status; 16137836SJohn.Forte@Sun.COM 16147836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 16157836SJohn.Forte@Sun.COM InitLibrary(); 16167836SJohn.Forte@Sun.COM 16177836SJohn.Forte@Sun.COM if (ppList == NULL) 16187836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 16197836SJohn.Forte@Sun.COM 16207836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 16217836SJohn.Forte@Sun.COM // Get total id count first 16227836SJohn.Forte@Sun.COM totalIdCount = 0; 16237836SJohn.Forte@Sun.COM 16247836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 16257836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 16267836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 16277836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 16287836SJohn.Forte@Sun.COM #ifdef WIN32 16297836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaOidListFn) 16307836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 16317836SJohn.Forte@Sun.COM "IMA_GetPhbaOidList"); 16327836SJohn.Forte@Sun.COM #else 16337836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaOidListFn) 16347836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 16357836SJohn.Forte@Sun.COM "IMA_GetPhbaOidList"); 16367836SJohn.Forte@Sun.COM #endif 16377836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 16387836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 16397836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 16407836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 16417836SJohn.Forte@Sun.COM totalIdCount += ppOidList->oidCount; 16427836SJohn.Forte@Sun.COM #ifdef WIN32 16437836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 16447836SJohn.Forte@Sun.COM GetProcAddress( 16457836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 16467836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 16477836SJohn.Forte@Sun.COM #else 16487836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 16497836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 16507836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 16517836SJohn.Forte@Sun.COM #endif 16527836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 16537836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 16547836SJohn.Forte@Sun.COM } 16557836SJohn.Forte@Sun.COM } 16567836SJohn.Forte@Sun.COM } 16577836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 16587836SJohn.Forte@Sun.COM } 16597836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 16607836SJohn.Forte@Sun.COM break; 16617836SJohn.Forte@Sun.COM } 16627836SJohn.Forte@Sun.COM 16637836SJohn.Forte@Sun.COM } 16647836SJohn.Forte@Sun.COM 16657836SJohn.Forte@Sun.COM 16667836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + 16677836SJohn.Forte@Sun.COM (totalIdCount - 1) * sizeof (IMA_OID)); 16687836SJohn.Forte@Sun.COM 16697836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 16707836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 16717836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 16727836SJohn.Forte@Sun.COM } 16737836SJohn.Forte@Sun.COM 16747836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 16757836SJohn.Forte@Sun.COM 16767836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 16777836SJohn.Forte@Sun.COM totalIdCount = 0; 16787836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 16797836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 16807836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 16817836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 16827836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 16837836SJohn.Forte@Sun.COM #ifdef WIN32 16847836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaOidListFn) 16857836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 16867836SJohn.Forte@Sun.COM "IMA_GetPhbaOidList"); 16877836SJohn.Forte@Sun.COM #else 16887836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaOidListFn) 16897836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 16907836SJohn.Forte@Sun.COM "IMA_GetPhbaOidList"); 16917836SJohn.Forte@Sun.COM #endif 16927836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 16937836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 16947836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 16957836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 16967836SJohn.Forte@Sun.COM for (j = 0; 16977836SJohn.Forte@Sun.COM (j < ppOidList->oidCount) && 16987836SJohn.Forte@Sun.COM (totalIdCount < 16997836SJohn.Forte@Sun.COM (*ppList)->oidCount); 17007836SJohn.Forte@Sun.COM j++) { 17017836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 17027836SJohn.Forte@Sun.COM objectType = 17037836SJohn.Forte@Sun.COM ppOidList->oids[j]. 17047836SJohn.Forte@Sun.COM objectType; 17057836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 17067836SJohn.Forte@Sun.COM objectSequenceNumber = 17077836SJohn.Forte@Sun.COM ppOidList->oids[j]. 17087836SJohn.Forte@Sun.COM objectSequenceNumber; 17097836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 17107836SJohn.Forte@Sun.COM ownerId = 17117836SJohn.Forte@Sun.COM ppOidList->oids[j].ownerId; 17127836SJohn.Forte@Sun.COM totalIdCount++; 17137836SJohn.Forte@Sun.COM } 17147836SJohn.Forte@Sun.COM #ifdef WIN32 17157836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 17167836SJohn.Forte@Sun.COM GetProcAddress 17177836SJohn.Forte@Sun.COM (plugintable[i].hPlugin, 17187836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 17197836SJohn.Forte@Sun.COM #else 17207836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 17217836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 17227836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 17237836SJohn.Forte@Sun.COM #endif 17247836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 17257836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 17267836SJohn.Forte@Sun.COM } 17277836SJohn.Forte@Sun.COM } 17287836SJohn.Forte@Sun.COM } 17297836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 17307836SJohn.Forte@Sun.COM } 17317836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 17327836SJohn.Forte@Sun.COM free(*ppList); 17337836SJohn.Forte@Sun.COM break; 17347836SJohn.Forte@Sun.COM } 17357836SJohn.Forte@Sun.COM } 17367836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 17377836SJohn.Forte@Sun.COM return (status); 17387836SJohn.Forte@Sun.COM } 17397836SJohn.Forte@Sun.COM 17407836SJohn.Forte@Sun.COM 17417836SJohn.Forte@Sun.COM /* 17427836SJohn.Forte@Sun.COM * Gets the general properties of a physical HBA. 17437836SJohn.Forte@Sun.COM * 17447836SJohn.Forte@Sun.COM * @param phbaId The object ID of the PHBA whose 17457836SJohn.Forte@Sun.COM * properties are being queried. 17467836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref 17477836SJohn.Forte@Sun.COM * IMA_PHBA_PROPERTIES structure. On successful 17487836SJohn.Forte@Sun.COM * return this will contain the properties of 17497836SJohn.Forte@Sun.COM * the PHBA specified by @a phbaId. 17507836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the 17517836SJohn.Forte@Sun.COM * operation was successful or if an error 17527836SJohn.Forte@Sun.COM * occurred. 17537836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the properties 17547836SJohn.Forte@Sun.COM * of the specified PHBA have been 17557836SJohn.Forte@Sun.COM * successfully retrieved. 17567836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned 17577836SJohn.Forte@Sun.COM * if @a pProps is NULL or specifies a 17587836SJohn.Forte@Sun.COM * memory area to which data cannot be written. 17597836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned 17607836SJohn.Forte@Sun.COM * if @a phbaId does not specify any 17617836SJohn.Forte@Sun.COM * valid object type. 17627836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned 17637836SJohn.Forte@Sun.COM * if @a phbaId does not specify a 17647836SJohn.Forte@Sun.COM * PHBA. 17657836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned 17667836SJohn.Forte@Sun.COM * if @a phbaId does not specify a PHBA 17677836SJohn.Forte@Sun.COM * which is currently known to the system. 17687836SJohn.Forte@Sun.COM */ 17697836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPhbaProperties( 17707836SJohn.Forte@Sun.COM IMA_OID phbaId, 17717836SJohn.Forte@Sun.COM IMA_PHBA_PROPERTIES *pProps) { 17727836SJohn.Forte@Sun.COM IMA_GetPhbaPropertiesFn PassFunc; 17737836SJohn.Forte@Sun.COM IMA_UINT i; 17747836SJohn.Forte@Sun.COM IMA_STATUS status; 17757836SJohn.Forte@Sun.COM 17767836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 17777836SJohn.Forte@Sun.COM InitLibrary(); 17787836SJohn.Forte@Sun.COM 17797836SJohn.Forte@Sun.COM if (pProps == NULL) 17807836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 17817836SJohn.Forte@Sun.COM 17827836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA) 17837836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 17847836SJohn.Forte@Sun.COM 17857836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 17867836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 17877836SJohn.Forte@Sun.COM 17887836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 17897836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 17907836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 17917836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 17927836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 17937836SJohn.Forte@Sun.COM #ifdef WIN32 17947836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaPropertiesFn) 17957836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 17967836SJohn.Forte@Sun.COM "IMA_GetPhbaProperties"); 17977836SJohn.Forte@Sun.COM #else 17987836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaPropertiesFn) 17997836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 18007836SJohn.Forte@Sun.COM "IMA_GetPhbaProperties"); 18017836SJohn.Forte@Sun.COM #endif 18027836SJohn.Forte@Sun.COM 18037836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 18047836SJohn.Forte@Sun.COM status = PassFunc(phbaId, pProps); 18057836SJohn.Forte@Sun.COM } 18067836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 18077836SJohn.Forte@Sun.COM } 18087836SJohn.Forte@Sun.COM 18097836SJohn.Forte@Sun.COM break; 18107836SJohn.Forte@Sun.COM } 18117836SJohn.Forte@Sun.COM } 18127836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 18137836SJohn.Forte@Sun.COM return (status); 18147836SJohn.Forte@Sun.COM } 18157836SJohn.Forte@Sun.COM 18167836SJohn.Forte@Sun.COM /* 18177836SJohn.Forte@Sun.COM * Frees a previously allocated IMA_OID_LIST structure. 18187836SJohn.Forte@Sun.COM * 18197836SJohn.Forte@Sun.COM * @param pList A pointer to an @ref IMA_OID_LIST 18207836SJohn.Forte@Sun.COM * structure allocated by the 18217836SJohn.Forte@Sun.COM * library. On successful return the memory 18227836SJohn.Forte@Sun.COM * allocated by the list is freed. 18237836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation 18247836SJohn.Forte@Sun.COM * was successful or if an error occurred. 18257836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the specified object 18267836SJohn.Forte@Sun.COM * ID list was successfully freed. 18277836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned 18287836SJohn.Forte@Sun.COM * if @a pList is NULL or specifies a 18297836SJohn.Forte@Sun.COM * memory area from which data cannot be read. 18307836SJohn.Forte@Sun.COM */ 18317836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_FreeMemory( 18327836SJohn.Forte@Sun.COM void *pMemory) { 18337836SJohn.Forte@Sun.COM if (pMemory == NULL) 18347836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 18357836SJohn.Forte@Sun.COM free(pMemory); 18367836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 18377836SJohn.Forte@Sun.COM } 18387836SJohn.Forte@Sun.COM 18397836SJohn.Forte@Sun.COM 18407836SJohn.Forte@Sun.COM 18417836SJohn.Forte@Sun.COM 18427836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetNonSharedNodeOidList( 18437836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 18447836SJohn.Forte@Sun.COM IMA_GetNonSharedNodeOidListFn PassFunc; 18457836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 18467836SJohn.Forte@Sun.COM 18477836SJohn.Forte@Sun.COM IMA_UINT i; 18487836SJohn.Forte@Sun.COM IMA_UINT j; 18497836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 18507836SJohn.Forte@Sun.COM IMA_STATUS status; 18517836SJohn.Forte@Sun.COM 18527836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 18537836SJohn.Forte@Sun.COM InitLibrary(); 18547836SJohn.Forte@Sun.COM 18557836SJohn.Forte@Sun.COM if (ppList == NULL) 18567836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 18577836SJohn.Forte@Sun.COM 18587836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 18597836SJohn.Forte@Sun.COM // Get total id count first 18607836SJohn.Forte@Sun.COM totalIdCount = 0; 18617836SJohn.Forte@Sun.COM 18627836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 18637836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 18647836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 18657836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 18667836SJohn.Forte@Sun.COM #ifdef WIN32 18677836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNonSharedNodeOidListFn) 18687836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 18697836SJohn.Forte@Sun.COM "IMA_GetNonSharedNodeOidList"); 18707836SJohn.Forte@Sun.COM #else 18717836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNonSharedNodeOidListFn) 18727836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 18737836SJohn.Forte@Sun.COM "IMA_GetNonSharedNodeOidList"); 18747836SJohn.Forte@Sun.COM #endif 18757836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 18767836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 18777836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 18787836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 18797836SJohn.Forte@Sun.COM totalIdCount += ppOidList->oidCount; 18807836SJohn.Forte@Sun.COM #ifdef WIN32 18817836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 18827836SJohn.Forte@Sun.COM GetProcAddress( 18837836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 18847836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 18857836SJohn.Forte@Sun.COM #else 18867836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 18877836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 18887836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 18897836SJohn.Forte@Sun.COM #endif 18907836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 18917836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 18927836SJohn.Forte@Sun.COM } 18937836SJohn.Forte@Sun.COM } 18947836SJohn.Forte@Sun.COM } 18957836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 18967836SJohn.Forte@Sun.COM } 18977836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 18987836SJohn.Forte@Sun.COM break; 18997836SJohn.Forte@Sun.COM } 19007836SJohn.Forte@Sun.COM 19017836SJohn.Forte@Sun.COM } 19027836SJohn.Forte@Sun.COM 19037836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + 19047836SJohn.Forte@Sun.COM (totalIdCount - 1) * sizeof (IMA_OID)); 19057836SJohn.Forte@Sun.COM 19067836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 19077836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 19087836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 19097836SJohn.Forte@Sun.COM } 19107836SJohn.Forte@Sun.COM 19117836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 19127836SJohn.Forte@Sun.COM 19137836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 19147836SJohn.Forte@Sun.COM totalIdCount = 0; 19157836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 19167836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 19177836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 19187836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 19197836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 19207836SJohn.Forte@Sun.COM #ifdef WIN32 19217836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNonSharedNodeOidListFn) 19227836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 19237836SJohn.Forte@Sun.COM "IMA_GetNonSharedNodeOidList"); 19247836SJohn.Forte@Sun.COM #else 19257836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNonSharedNodeOidListFn) 19267836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 19277836SJohn.Forte@Sun.COM "IMA_GetNonSharedNodeOidList"); 19287836SJohn.Forte@Sun.COM #endif 19297836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 19307836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 19317836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 19327836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 19337836SJohn.Forte@Sun.COM for (j = 0; 19347836SJohn.Forte@Sun.COM (j < ppOidList->oidCount) && 19357836SJohn.Forte@Sun.COM (totalIdCount < ( 19367836SJohn.Forte@Sun.COM *ppList)->oidCount); 19377836SJohn.Forte@Sun.COM j++) { 19387836SJohn.Forte@Sun.COM (*ppList)->oids[ 19397836SJohn.Forte@Sun.COM totalIdCount].objectType = 19407836SJohn.Forte@Sun.COM ppOidList->oids[j]. 19417836SJohn.Forte@Sun.COM objectType; 19427836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 19437836SJohn.Forte@Sun.COM objectSequenceNumber = 19447836SJohn.Forte@Sun.COM ppOidList->oids[j]. 19457836SJohn.Forte@Sun.COM objectSequenceNumber; 19467836SJohn.Forte@Sun.COM (*ppList)->oids[ 19477836SJohn.Forte@Sun.COM totalIdCount]. 19487836SJohn.Forte@Sun.COM ownerId = 19497836SJohn.Forte@Sun.COM ppOidList->oids[j]. 19507836SJohn.Forte@Sun.COM ownerId; 19517836SJohn.Forte@Sun.COM totalIdCount++; 19527836SJohn.Forte@Sun.COM } 19537836SJohn.Forte@Sun.COM #ifdef WIN32 19547836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 19557836SJohn.Forte@Sun.COM GetProcAddress( 19567836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 19577836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 19587836SJohn.Forte@Sun.COM #else 19597836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 19607836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 19617836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 19627836SJohn.Forte@Sun.COM #endif 19637836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 19647836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 19657836SJohn.Forte@Sun.COM } 19667836SJohn.Forte@Sun.COM } 19677836SJohn.Forte@Sun.COM } 19687836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 19697836SJohn.Forte@Sun.COM } 19707836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 19717836SJohn.Forte@Sun.COM free(*ppList); 19727836SJohn.Forte@Sun.COM break; 19737836SJohn.Forte@Sun.COM } 19747836SJohn.Forte@Sun.COM } 19757836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 19767836SJohn.Forte@Sun.COM return (status); 19777836SJohn.Forte@Sun.COM } 19787836SJohn.Forte@Sun.COM 19797836SJohn.Forte@Sun.COM 19807836SJohn.Forte@Sun.COM 19817836SJohn.Forte@Sun.COM /* 19827836SJohn.Forte@Sun.COM * Gets the first burst length properties of 19837836SJohn.Forte@Sun.COM * the specified logical HBA. 19847836SJohn.Forte@Sun.COM * 19857836SJohn.Forte@Sun.COM * @param lhbaId The object ID of the logical HBA 19867836SJohn.Forte@Sun.COM * to get the first burst length 19877836SJohn.Forte@Sun.COM * properties of. 19887836SJohn.Forte@Sun.COM * @param pProps A pointer to a min/max values 19897836SJohn.Forte@Sun.COM * structure. 19907836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation 19917836SJohn.Forte@Sun.COM * was successful or if an error 19927836SJohn.Forte@Sun.COM * occurred. 19937836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the first burst 19947836SJohn.Forte@Sun.COM * length properties have been 19957836SJohn.Forte@Sun.COM * successfully retrieved. 19967836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned 19977836SJohn.Forte@Sun.COM * if @a pProps is NULL or specifies a 19987836SJohn.Forte@Sun.COM * memory area to which data cannot be written. 19997836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned 20007836SJohn.Forte@Sun.COM * if @a lhbaId does not specify any 20017836SJohn.Forte@Sun.COM * valid object type. 20027836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned 20037836SJohn.Forte@Sun.COM * if @a lhbaId does not specify a LHBA. 20047836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned 20057836SJohn.Forte@Sun.COM * @a lhbaId does not specify a LHBA 20067836SJohn.Forte@Sun.COM * which is currently known to the system. 20077836SJohn.Forte@Sun.COM */ 20087836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetFirstBurstLengthProperties( 20097836SJohn.Forte@Sun.COM IMA_OID Oid, 20107836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 20117836SJohn.Forte@Sun.COM IMA_GetFirstBurstLengthPropertiesFn PassFunc; 20127836SJohn.Forte@Sun.COM IMA_UINT i; 20137836SJohn.Forte@Sun.COM IMA_STATUS status; 20147836SJohn.Forte@Sun.COM 20157836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 20167836SJohn.Forte@Sun.COM InitLibrary(); 20177836SJohn.Forte@Sun.COM 20187836SJohn.Forte@Sun.COM if (pProps == NULL) 20197836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 20207836SJohn.Forte@Sun.COM 20217836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 20227836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 20237836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 20247836SJohn.Forte@Sun.COM 20257836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 20267836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 20277836SJohn.Forte@Sun.COM 20287836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 20297836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 20307836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 20317836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 20327836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 20337836SJohn.Forte@Sun.COM #ifdef WIN32 20347836SJohn.Forte@Sun.COM PassFunc = 20357836SJohn.Forte@Sun.COM (IMA_GetFirstBurstLengthPropertiesFn) 20367836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 20377836SJohn.Forte@Sun.COM "IMA_GetFirstBurstLengthProperties"); 20387836SJohn.Forte@Sun.COM #else 20397836SJohn.Forte@Sun.COM PassFunc = 20407836SJohn.Forte@Sun.COM (IMA_GetFirstBurstLengthPropertiesFn) 20417836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 20427836SJohn.Forte@Sun.COM "IMA_GetFirstBurstLengthProperties"); 20437836SJohn.Forte@Sun.COM #endif 20447836SJohn.Forte@Sun.COM 20457836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 20467836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 20477836SJohn.Forte@Sun.COM } 20487836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 20497836SJohn.Forte@Sun.COM } 20507836SJohn.Forte@Sun.COM 20517836SJohn.Forte@Sun.COM break; 20527836SJohn.Forte@Sun.COM } 20537836SJohn.Forte@Sun.COM } 20547836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 20557836SJohn.Forte@Sun.COM return (status); 20567836SJohn.Forte@Sun.COM } 20577836SJohn.Forte@Sun.COM 20587836SJohn.Forte@Sun.COM /* 20597836SJohn.Forte@Sun.COM * Gets the max burst length properties of the 20607836SJohn.Forte@Sun.COM * specified logical HBA. 20617836SJohn.Forte@Sun.COM * 20627836SJohn.Forte@Sun.COM * @param lhbaId The object ID of the logical HBA to 20637836SJohn.Forte@Sun.COM * get the max burst length properties of. 20647836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref IMA_MIN_MAX_VALUE 20657836SJohn.Forte@Sun.COM * structure allocated by the 20667836SJohn.Forte@Sun.COM * caller. On successful return this structure 20677836SJohn.Forte@Sun.COM * will contain the max 20687836SJohn.Forte@Sun.COM * burst length properties of this LHBA. 20697836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation 20707836SJohn.Forte@Sun.COM * was successful or if an error occurred. 20717836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the max burst 20727836SJohn.Forte@Sun.COM * length properties have been 20737836SJohn.Forte@Sun.COM * successfully retrieved. 20747836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned 20757836SJohn.Forte@Sun.COM * if @a pProps is NULL or specifies a 20767836SJohn.Forte@Sun.COM * memory area to which data cannot be written. 20777836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned 20787836SJohn.Forte@Sun.COM * if @a lhbaId does not specify any 20797836SJohn.Forte@Sun.COM * valid object type. 20807836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned 20817836SJohn.Forte@Sun.COM * if @a lhbaId does not specify a HBA. 20827836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned 20837836SJohn.Forte@Sun.COM * if @a lhbaId does not specify a LHBA 20847836SJohn.Forte@Sun.COM * which is currently known to the system. 20857836SJohn.Forte@Sun.COM */ 20867836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetMaxBurstLengthProperties( 20877836SJohn.Forte@Sun.COM IMA_OID Oid, 20887836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 20897836SJohn.Forte@Sun.COM IMA_GetMaxBurstLengthPropertiesFn PassFunc; 20907836SJohn.Forte@Sun.COM IMA_UINT i; 20917836SJohn.Forte@Sun.COM IMA_STATUS status; 20927836SJohn.Forte@Sun.COM 20937836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 20947836SJohn.Forte@Sun.COM InitLibrary(); 20957836SJohn.Forte@Sun.COM 20967836SJohn.Forte@Sun.COM if (pProps == NULL) 20977836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 20987836SJohn.Forte@Sun.COM 20997836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 21007836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 21017836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 21027836SJohn.Forte@Sun.COM 21037836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 21047836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 21057836SJohn.Forte@Sun.COM 21067836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 21077836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 21087836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 21097836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 21107836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 21117836SJohn.Forte@Sun.COM #ifdef WIN32 21127836SJohn.Forte@Sun.COM PassFunc = 21137836SJohn.Forte@Sun.COM (IMA_GetMaxBurstLengthPropertiesFn) 21147836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 21157836SJohn.Forte@Sun.COM "IMA_GetMaxBurstLengthProperties"); 21167836SJohn.Forte@Sun.COM #else 21177836SJohn.Forte@Sun.COM PassFunc = 21187836SJohn.Forte@Sun.COM (IMA_GetMaxBurstLengthPropertiesFn) 21197836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 21207836SJohn.Forte@Sun.COM "IMA_GetMaxBurstLengthProperties"); 21217836SJohn.Forte@Sun.COM #endif 21227836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 21237836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 21247836SJohn.Forte@Sun.COM } 21257836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 21267836SJohn.Forte@Sun.COM } 21277836SJohn.Forte@Sun.COM 21287836SJohn.Forte@Sun.COM break; 21297836SJohn.Forte@Sun.COM } 21307836SJohn.Forte@Sun.COM } 21317836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 21327836SJohn.Forte@Sun.COM return (status); 21337836SJohn.Forte@Sun.COM } 21347836SJohn.Forte@Sun.COM 21357836SJohn.Forte@Sun.COM 21367836SJohn.Forte@Sun.COM /* 21377836SJohn.Forte@Sun.COM * Gets the maximum receive data segment length properties 21387836SJohn.Forte@Sun.COM * of the specified logical HBA. 21397836SJohn.Forte@Sun.COM * 21407836SJohn.Forte@Sun.COM * @param lhbaId The object ID of the logical HBA to 21417836SJohn.Forte@Sun.COM * get the max receive data 21427836SJohn.Forte@Sun.COM * segment length properties of. 21437836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref IMA_MIN_MAX_VALUE 21447836SJohn.Forte@Sun.COM * structure allocated by the caller. 21457836SJohn.Forte@Sun.COM * On successful return this structure will contain the max 21467836SJohn.Forte@Sun.COM * receive data segment length properties of this LHBA. 21477836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation 21487836SJohn.Forte@Sun.COM * was successful or if an error occurred. 21497836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the max receive 21507836SJohn.Forte@Sun.COM * data segment length properties 21517836SJohn.Forte@Sun.COM * have been successfully retrieved. 21527836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if 21537836SJohn.Forte@Sun.COM * @a pProps is NULL or specifies a 21547836SJohn.Forte@Sun.COM * memory area to which data cannot be written. 21557836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if 21567836SJohn.Forte@Sun.COM * @a lhbaId does not specify any 21577836SJohn.Forte@Sun.COM * valid object type. 21587836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if 21597836SJohn.Forte@Sun.COM * a lhbaId does not specify a LHBA. 21607836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a 21617836SJohn.Forte@Sun.COM * lhbaId does not specify a LHBA 21627836SJohn.Forte@Sun.COM * which is currently known to the system. 21637836SJohn.Forte@Sun.COM */ 21647836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetMaxRecvDataSegmentLengthProperties( 21657836SJohn.Forte@Sun.COM IMA_OID Oid, 21667836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 21677836SJohn.Forte@Sun.COM IMA_GetMaxRecvDataSegmentLengthPropertiesFn PassFunc; 21687836SJohn.Forte@Sun.COM IMA_UINT i; 21697836SJohn.Forte@Sun.COM IMA_STATUS status; 21707836SJohn.Forte@Sun.COM #define IMA_GMRDSLPFN IMA_GetMaxRecvDataSegmentLengthPropertiesFn 21717836SJohn.Forte@Sun.COM #define IMA_GMRDSLP "IMA_GetMaxRecvDataSegmentLengthProperties" 21727836SJohn.Forte@Sun.COM 21737836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 21747836SJohn.Forte@Sun.COM InitLibrary(); 21757836SJohn.Forte@Sun.COM 21767836SJohn.Forte@Sun.COM if (pProps == NULL) 21777836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 21787836SJohn.Forte@Sun.COM 21797836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 21807836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 21817836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 21827836SJohn.Forte@Sun.COM 21837836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 21847836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 21857836SJohn.Forte@Sun.COM 21867836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 21877836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 21887836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 21897836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 21907836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 21917836SJohn.Forte@Sun.COM #ifdef WIN32 21927836SJohn.Forte@Sun.COM PassFunc = 21937836SJohn.Forte@Sun.COM (IMA_GMRDSLPFN) 21947836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 21957836SJohn.Forte@Sun.COM IMA_GMRDSLP); 21967836SJohn.Forte@Sun.COM #else 21977836SJohn.Forte@Sun.COM PassFunc = 21987836SJohn.Forte@Sun.COM (IMA_GMRDSLPFN) 21997836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 22007836SJohn.Forte@Sun.COM IMA_GMRDSLP); 22017836SJohn.Forte@Sun.COM #endif 22027836SJohn.Forte@Sun.COM 22037836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 22047836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 22057836SJohn.Forte@Sun.COM } 22067836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 22077836SJohn.Forte@Sun.COM } 22087836SJohn.Forte@Sun.COM 22097836SJohn.Forte@Sun.COM break; 22107836SJohn.Forte@Sun.COM } 22117836SJohn.Forte@Sun.COM } 22127836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 22137836SJohn.Forte@Sun.COM #undef IMA_GMRDSLPFN 22147836SJohn.Forte@Sun.COM #undef IMA_GMRDSLP 22157836SJohn.Forte@Sun.COM return (status); 22167836SJohn.Forte@Sun.COM } 22177836SJohn.Forte@Sun.COM 22187836SJohn.Forte@Sun.COM 22197836SJohn.Forte@Sun.COM 22207836SJohn.Forte@Sun.COM /* --------------------------------------------- */ 22217836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_PluginIOCtl( 22227836SJohn.Forte@Sun.COM IMA_OID pluginOid, 22237836SJohn.Forte@Sun.COM IMA_UINT command, 22247836SJohn.Forte@Sun.COM const void *pInputBuffer, 22257836SJohn.Forte@Sun.COM IMA_UINT inputBufferLength, 22267836SJohn.Forte@Sun.COM void *pOutputBuffer, 22277836SJohn.Forte@Sun.COM IMA_UINT *pOutputBufferLength) { 22287836SJohn.Forte@Sun.COM IMA_PluginIOCtlFn PassFunc; 22297836SJohn.Forte@Sun.COM IMA_UINT i; 22307836SJohn.Forte@Sun.COM IMA_STATUS status; 22317836SJohn.Forte@Sun.COM 22327836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 22337836SJohn.Forte@Sun.COM InitLibrary(); 22347836SJohn.Forte@Sun.COM 22357836SJohn.Forte@Sun.COM if (pInputBuffer == NULL || inputBufferLength == 0 || 22367836SJohn.Forte@Sun.COM pOutputBuffer == NULL || pOutputBufferLength == NULL || 22377836SJohn.Forte@Sun.COM *pOutputBufferLength == 0) 22387836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 22397836SJohn.Forte@Sun.COM 22407836SJohn.Forte@Sun.COM if (pluginOid.objectType != IMA_OBJECT_TYPE_PLUGIN) 22417836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 22427836SJohn.Forte@Sun.COM 22437836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 22447836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 22457836SJohn.Forte@Sun.COM 22467836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 22477836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == pluginOid.ownerId) { 22487836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 22497836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 22507836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 22517836SJohn.Forte@Sun.COM #ifdef WIN32 22527836SJohn.Forte@Sun.COM PassFunc = (IMA_PluginIOCtlFn) 22537836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 22547836SJohn.Forte@Sun.COM "IMA_PluginIOCtl"); 22557836SJohn.Forte@Sun.COM #else 22567836SJohn.Forte@Sun.COM PassFunc = (IMA_PluginIOCtlFn) 22577836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 22587836SJohn.Forte@Sun.COM "IMA_PluginIOCtl"); 22597836SJohn.Forte@Sun.COM #endif 22607836SJohn.Forte@Sun.COM 22617836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 22627836SJohn.Forte@Sun.COM status = PassFunc( 22637836SJohn.Forte@Sun.COM pluginOid, command, 22647836SJohn.Forte@Sun.COM pInputBuffer, inputBufferLength, 22657836SJohn.Forte@Sun.COM pOutputBuffer, pOutputBufferLength); 22667836SJohn.Forte@Sun.COM } 22677836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 22687836SJohn.Forte@Sun.COM } 22697836SJohn.Forte@Sun.COM 22707836SJohn.Forte@Sun.COM break; 22717836SJohn.Forte@Sun.COM } 22727836SJohn.Forte@Sun.COM } 22737836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 22747836SJohn.Forte@Sun.COM return (status); 22757836SJohn.Forte@Sun.COM } 22767836SJohn.Forte@Sun.COM 22777836SJohn.Forte@Sun.COM 22787836SJohn.Forte@Sun.COM 22797836SJohn.Forte@Sun.COM 22807836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetNetworkPortalOidList( 22817836SJohn.Forte@Sun.COM IMA_OID lnpId, 22827836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 22837836SJohn.Forte@Sun.COM IMA_GetNetworkPortalOidListFn PassFunc; 22847836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 22857836SJohn.Forte@Sun.COM IMA_UINT i; 22867836SJohn.Forte@Sun.COM IMA_STATUS status; 22877836SJohn.Forte@Sun.COM 22887836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 22897836SJohn.Forte@Sun.COM InitLibrary(); 22907836SJohn.Forte@Sun.COM 22917836SJohn.Forte@Sun.COM if (ppList == NULL) 22927836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 22937836SJohn.Forte@Sun.COM 22947836SJohn.Forte@Sun.COM if (lnpId.objectType != IMA_OBJECT_TYPE_LNP) 22957836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 22967836SJohn.Forte@Sun.COM 22977836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 22987836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 22997836SJohn.Forte@Sun.COM 23007836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 23017836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lnpId.ownerId) { 23027836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 23037836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 23047836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 23057836SJohn.Forte@Sun.COM #ifdef WIN32 23067836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNetworkPortalOidListFn) 23077836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 23087836SJohn.Forte@Sun.COM "IMA_GetNetworkPortalOidList"); 23097836SJohn.Forte@Sun.COM #else 23107836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNetworkPortalOidListFn) 23117836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 23127836SJohn.Forte@Sun.COM "IMA_GetNetworkPortalOidList"); 23137836SJohn.Forte@Sun.COM #endif 23147836SJohn.Forte@Sun.COM 23157836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 23167836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 23177836SJohn.Forte@Sun.COM IMA_UINT listSize; 23187836SJohn.Forte@Sun.COM listSize = sizeof (IMA_OID_LIST); 23197836SJohn.Forte@Sun.COM status = PassFunc(lnpId, &ppOidList); 23207836SJohn.Forte@Sun.COM if (IMA_SUCCESS(status)) { 23217836SJohn.Forte@Sun.COM 23227836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*) 23237836SJohn.Forte@Sun.COM calloc(1, 23247836SJohn.Forte@Sun.COM sizeof (IMA_OID_LIST) 23257836SJohn.Forte@Sun.COM + (ppOidList-> 23267836SJohn.Forte@Sun.COM oidCount - 1)* 23277836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 23287836SJohn.Forte@Sun.COM 23297836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 23307836SJohn.Forte@Sun.COM return (EUOS_ERROR); 23317836SJohn.Forte@Sun.COM } 23327836SJohn.Forte@Sun.COM else 23337836SJohn.Forte@Sun.COM memcpy((*ppList), 23347836SJohn.Forte@Sun.COM ppOidList, 23357836SJohn.Forte@Sun.COM listSize 23367836SJohn.Forte@Sun.COM + (ppOidList-> 23377836SJohn.Forte@Sun.COM oidCount - 1)* 23387836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 23397836SJohn.Forte@Sun.COM #ifdef WIN32 23407836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 23417836SJohn.Forte@Sun.COM GetProcAddress( 23427836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 23437836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 23447836SJohn.Forte@Sun.COM #else 23457836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 23467836SJohn.Forte@Sun.COM dlsym( 23477836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 23487836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 23497836SJohn.Forte@Sun.COM #endif 23507836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 23517836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 23527836SJohn.Forte@Sun.COM } 23537836SJohn.Forte@Sun.COM } 23547836SJohn.Forte@Sun.COM } 23557836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 23567836SJohn.Forte@Sun.COM } 23577836SJohn.Forte@Sun.COM 23587836SJohn.Forte@Sun.COM break; 23597836SJohn.Forte@Sun.COM } 23607836SJohn.Forte@Sun.COM } 23617836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 23627836SJohn.Forte@Sun.COM return (status); 23637836SJohn.Forte@Sun.COM } 23647836SJohn.Forte@Sun.COM 23657836SJohn.Forte@Sun.COM 23667836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetFirstBurstLength( 23677836SJohn.Forte@Sun.COM IMA_OID lhbaId, 23687836SJohn.Forte@Sun.COM IMA_UINT firstBurstLength) { 23697836SJohn.Forte@Sun.COM IMA_SetFirstBurstLengthFn PassFunc; 23707836SJohn.Forte@Sun.COM IMA_UINT i; 23717836SJohn.Forte@Sun.COM IMA_STATUS status; 23727836SJohn.Forte@Sun.COM 23737836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 23747836SJohn.Forte@Sun.COM InitLibrary(); 23757836SJohn.Forte@Sun.COM 23767836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 23777836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 23787836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 23797836SJohn.Forte@Sun.COM 23807836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 23817836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 23827836SJohn.Forte@Sun.COM 23837836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 23847836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 23857836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 23867836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 23877836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 23887836SJohn.Forte@Sun.COM #ifdef WIN32 23897836SJohn.Forte@Sun.COM PassFunc = (IMA_SetFirstBurstLengthFn) 23907836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 23917836SJohn.Forte@Sun.COM "IMA_SetFirstBurstLength"); 23927836SJohn.Forte@Sun.COM #else 23937836SJohn.Forte@Sun.COM PassFunc = (IMA_SetFirstBurstLengthFn) 23947836SJohn.Forte@Sun.COM dlsym( 23957836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 23967836SJohn.Forte@Sun.COM "IMA_SetFirstBurstLength"); 23977836SJohn.Forte@Sun.COM #endif 23987836SJohn.Forte@Sun.COM 23997836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 24007836SJohn.Forte@Sun.COM status = PassFunc( 24017836SJohn.Forte@Sun.COM lhbaId, firstBurstLength); 24027836SJohn.Forte@Sun.COM } 24037836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 24047836SJohn.Forte@Sun.COM } 24057836SJohn.Forte@Sun.COM 24067836SJohn.Forte@Sun.COM break; 24077836SJohn.Forte@Sun.COM } 24087836SJohn.Forte@Sun.COM } 24097836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 24107836SJohn.Forte@Sun.COM return (status); 24117836SJohn.Forte@Sun.COM } 24127836SJohn.Forte@Sun.COM 24137836SJohn.Forte@Sun.COM 24147836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetMaxBurstLength( 24157836SJohn.Forte@Sun.COM IMA_OID lhbaId, 24167836SJohn.Forte@Sun.COM IMA_UINT maxBurstLength) { 24177836SJohn.Forte@Sun.COM IMA_SetMaxBurstLengthFn PassFunc; 24187836SJohn.Forte@Sun.COM IMA_UINT i; 24197836SJohn.Forte@Sun.COM IMA_STATUS status; 24207836SJohn.Forte@Sun.COM 24217836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 24227836SJohn.Forte@Sun.COM InitLibrary(); 24237836SJohn.Forte@Sun.COM 24247836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 24257836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 24267836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 24277836SJohn.Forte@Sun.COM 24287836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 24297836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 24307836SJohn.Forte@Sun.COM 24317836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 24327836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 24337836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 24347836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 24357836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 24367836SJohn.Forte@Sun.COM #ifdef WIN32 24377836SJohn.Forte@Sun.COM PassFunc = (IMA_SetMaxBurstLengthFn) 24387836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 24397836SJohn.Forte@Sun.COM "IMA_SetMaxBurstLength"); 24407836SJohn.Forte@Sun.COM #else 24417836SJohn.Forte@Sun.COM PassFunc = (IMA_SetMaxBurstLengthFn) 24427836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 24437836SJohn.Forte@Sun.COM "IMA_SetMaxBurstLength"); 24447836SJohn.Forte@Sun.COM #endif 24457836SJohn.Forte@Sun.COM 24467836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 24477836SJohn.Forte@Sun.COM status = PassFunc( 24487836SJohn.Forte@Sun.COM lhbaId, maxBurstLength); 24497836SJohn.Forte@Sun.COM } 24507836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 24517836SJohn.Forte@Sun.COM } 24527836SJohn.Forte@Sun.COM 24537836SJohn.Forte@Sun.COM break; 24547836SJohn.Forte@Sun.COM } 24557836SJohn.Forte@Sun.COM } 24567836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 24577836SJohn.Forte@Sun.COM return (status); 24587836SJohn.Forte@Sun.COM } 24597836SJohn.Forte@Sun.COM 24607836SJohn.Forte@Sun.COM 24617836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetMaxRecvDataSegmentLength( 24627836SJohn.Forte@Sun.COM IMA_OID lhbaId, 24637836SJohn.Forte@Sun.COM IMA_UINT maxRecvDataSegmentLength) { 24647836SJohn.Forte@Sun.COM IMA_SetMaxRecvDataSegmentLengthFn PassFunc; 24657836SJohn.Forte@Sun.COM IMA_UINT i; 24667836SJohn.Forte@Sun.COM IMA_STATUS status; 24677836SJohn.Forte@Sun.COM 24687836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 24697836SJohn.Forte@Sun.COM InitLibrary(); 24707836SJohn.Forte@Sun.COM 24717836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 24727836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 24737836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 24747836SJohn.Forte@Sun.COM 24757836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 24767836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 24777836SJohn.Forte@Sun.COM 24787836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 24797836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 24807836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 24817836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 24827836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 24837836SJohn.Forte@Sun.COM #ifdef WIN32 24847836SJohn.Forte@Sun.COM PassFunc = 24857836SJohn.Forte@Sun.COM (IMA_SetMaxRecvDataSegmentLengthFn) 24867836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 24877836SJohn.Forte@Sun.COM "IMA_SetMaxRecvDataSegmentLength"); 24887836SJohn.Forte@Sun.COM #else 24897836SJohn.Forte@Sun.COM PassFunc = 24907836SJohn.Forte@Sun.COM (IMA_SetMaxRecvDataSegmentLengthFn) 24917836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 24927836SJohn.Forte@Sun.COM "IMA_SetMaxRecvDataSegmentLength"); 24937836SJohn.Forte@Sun.COM #endif 24947836SJohn.Forte@Sun.COM 24957836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 24967836SJohn.Forte@Sun.COM status = PassFunc( 24977836SJohn.Forte@Sun.COM lhbaId, 24987836SJohn.Forte@Sun.COM maxRecvDataSegmentLength); 24997836SJohn.Forte@Sun.COM } 25007836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 25017836SJohn.Forte@Sun.COM } 25027836SJohn.Forte@Sun.COM 25037836SJohn.Forte@Sun.COM break; 25047836SJohn.Forte@Sun.COM } 25057836SJohn.Forte@Sun.COM } 25067836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 25077836SJohn.Forte@Sun.COM return (status); 25087836SJohn.Forte@Sun.COM } 25097836SJohn.Forte@Sun.COM 25107836SJohn.Forte@Sun.COM 25117836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetMaxConnectionsProperties( 25127836SJohn.Forte@Sun.COM IMA_OID Oid, 25137836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 25147836SJohn.Forte@Sun.COM IMA_GetMaxConnectionsPropertiesFn PassFunc; 25157836SJohn.Forte@Sun.COM IMA_UINT i; 25167836SJohn.Forte@Sun.COM IMA_STATUS status; 25177836SJohn.Forte@Sun.COM 25187836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 25197836SJohn.Forte@Sun.COM InitLibrary(); 25207836SJohn.Forte@Sun.COM 25217836SJohn.Forte@Sun.COM if (pProps == NULL) 25227836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 25237836SJohn.Forte@Sun.COM 25247836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 25257836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 25267836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 25277836SJohn.Forte@Sun.COM 25287836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 25297836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 25307836SJohn.Forte@Sun.COM 25317836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 25327836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 25337836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 25347836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 25357836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 25367836SJohn.Forte@Sun.COM #ifdef WIN32 25377836SJohn.Forte@Sun.COM PassFunc = 25387836SJohn.Forte@Sun.COM (IMA_GetMaxConnectionsPropertiesFn) 25397836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 25407836SJohn.Forte@Sun.COM "IMA_GetMaxConnectionsProperties"); 25417836SJohn.Forte@Sun.COM #else 25427836SJohn.Forte@Sun.COM PassFunc = 25437836SJohn.Forte@Sun.COM (IMA_GetMaxConnectionsPropertiesFn) 25447836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 25457836SJohn.Forte@Sun.COM "IMA_GetMaxConnectionsProperties"); 25467836SJohn.Forte@Sun.COM #endif 25477836SJohn.Forte@Sun.COM 25487836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 25497836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 25507836SJohn.Forte@Sun.COM } 25517836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 25527836SJohn.Forte@Sun.COM } 25537836SJohn.Forte@Sun.COM 25547836SJohn.Forte@Sun.COM break; 25557836SJohn.Forte@Sun.COM } 25567836SJohn.Forte@Sun.COM } 25577836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 25587836SJohn.Forte@Sun.COM return (status); 25597836SJohn.Forte@Sun.COM } 25607836SJohn.Forte@Sun.COM 25617836SJohn.Forte@Sun.COM 25627836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetMaxConnections( 25637836SJohn.Forte@Sun.COM IMA_OID lhbaId, 25647836SJohn.Forte@Sun.COM IMA_UINT maxConnections) { 25657836SJohn.Forte@Sun.COM IMA_SetMaxConnectionsFn PassFunc; 25667836SJohn.Forte@Sun.COM IMA_UINT i; 25677836SJohn.Forte@Sun.COM IMA_STATUS status; 25687836SJohn.Forte@Sun.COM 25697836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 25707836SJohn.Forte@Sun.COM InitLibrary(); 25717836SJohn.Forte@Sun.COM 25727836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 25737836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 25747836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 25757836SJohn.Forte@Sun.COM 25767836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 25777836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 25787836SJohn.Forte@Sun.COM 25797836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 25807836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 25817836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 25827836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 25837836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 25847836SJohn.Forte@Sun.COM #ifdef WIN32 25857836SJohn.Forte@Sun.COM PassFunc = (IMA_SetMaxConnectionsFn) 25867836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 25877836SJohn.Forte@Sun.COM "IMA_SetMaxConnections"); 25887836SJohn.Forte@Sun.COM #else 25897836SJohn.Forte@Sun.COM PassFunc = (IMA_SetMaxConnectionsFn) 25907836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 25917836SJohn.Forte@Sun.COM "IMA_SetMaxConnections"); 25927836SJohn.Forte@Sun.COM #endif 25937836SJohn.Forte@Sun.COM 25947836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 25957836SJohn.Forte@Sun.COM status = PassFunc( 25967836SJohn.Forte@Sun.COM lhbaId, maxConnections); 25977836SJohn.Forte@Sun.COM } 25987836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 25997836SJohn.Forte@Sun.COM } 26007836SJohn.Forte@Sun.COM 26017836SJohn.Forte@Sun.COM break; 26027836SJohn.Forte@Sun.COM } 26037836SJohn.Forte@Sun.COM } 26047836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 26057836SJohn.Forte@Sun.COM return (status); 26067836SJohn.Forte@Sun.COM } 26077836SJohn.Forte@Sun.COM 26087836SJohn.Forte@Sun.COM 26097836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDefaultTime2RetainProperties( 26107836SJohn.Forte@Sun.COM IMA_OID lhbaId, 26117836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 26127836SJohn.Forte@Sun.COM IMA_GetDefaultTime2RetainPropertiesFn PassFunc; 26137836SJohn.Forte@Sun.COM IMA_UINT i; 26147836SJohn.Forte@Sun.COM IMA_STATUS status; 26157836SJohn.Forte@Sun.COM 26167836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 26177836SJohn.Forte@Sun.COM InitLibrary(); 26187836SJohn.Forte@Sun.COM 26197836SJohn.Forte@Sun.COM if (pProps == NULL) 26207836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 26217836SJohn.Forte@Sun.COM 26227836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 26237836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 26247836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 26257836SJohn.Forte@Sun.COM 26267836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 26277836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 26287836SJohn.Forte@Sun.COM 26297836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 26307836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 26317836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 26327836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 26337836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 26347836SJohn.Forte@Sun.COM #ifdef WIN32 26357836SJohn.Forte@Sun.COM PassFunc = 26367836SJohn.Forte@Sun.COM (IMA_GetDefaultTime2RetainPropertiesFn) 26377836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 26387836SJohn.Forte@Sun.COM "IMA_GetDefaultTime2RetainProperties"); 26397836SJohn.Forte@Sun.COM #else 26407836SJohn.Forte@Sun.COM PassFunc = 26417836SJohn.Forte@Sun.COM (IMA_GetDefaultTime2RetainPropertiesFn) 26427836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 26437836SJohn.Forte@Sun.COM "IMA_GetDefaultTime2RetainProperties"); 26447836SJohn.Forte@Sun.COM #endif 26457836SJohn.Forte@Sun.COM 26467836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 26477836SJohn.Forte@Sun.COM status = PassFunc(lhbaId, pProps); 26487836SJohn.Forte@Sun.COM } 26497836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 26507836SJohn.Forte@Sun.COM } 26517836SJohn.Forte@Sun.COM 26527836SJohn.Forte@Sun.COM break; 26537836SJohn.Forte@Sun.COM } 26547836SJohn.Forte@Sun.COM } 26557836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 26567836SJohn.Forte@Sun.COM return (status); 26577836SJohn.Forte@Sun.COM } 26587836SJohn.Forte@Sun.COM 26597836SJohn.Forte@Sun.COM 26607836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetDefaultTime2Retain( 26617836SJohn.Forte@Sun.COM IMA_OID lhbaId, 26627836SJohn.Forte@Sun.COM IMA_UINT defaultTime2Retain) { 26637836SJohn.Forte@Sun.COM IMA_SetDefaultTime2RetainFn PassFunc; 26647836SJohn.Forte@Sun.COM IMA_UINT i; 26657836SJohn.Forte@Sun.COM IMA_STATUS status; 26667836SJohn.Forte@Sun.COM 26677836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 26687836SJohn.Forte@Sun.COM InitLibrary(); 26697836SJohn.Forte@Sun.COM 26707836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 26717836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 26727836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 26737836SJohn.Forte@Sun.COM 26747836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 26757836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 26767836SJohn.Forte@Sun.COM 26777836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 26787836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 26797836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 26807836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 26817836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 26827836SJohn.Forte@Sun.COM #ifdef WIN32 26837836SJohn.Forte@Sun.COM PassFunc = 26847836SJohn.Forte@Sun.COM (IMA_SetDefaultTime2RetainFn) 26857836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 26867836SJohn.Forte@Sun.COM "IMA_SetDefaultTime2Retain"); 26877836SJohn.Forte@Sun.COM #else 26887836SJohn.Forte@Sun.COM PassFunc = 26897836SJohn.Forte@Sun.COM (IMA_SetDefaultTime2RetainFn) 26907836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 26917836SJohn.Forte@Sun.COM "IMA_SetDefaultTime2Retain"); 26927836SJohn.Forte@Sun.COM #endif 26937836SJohn.Forte@Sun.COM 26947836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 26957836SJohn.Forte@Sun.COM status = PassFunc( 26967836SJohn.Forte@Sun.COM lhbaId, defaultTime2Retain); 26977836SJohn.Forte@Sun.COM } 26987836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 26997836SJohn.Forte@Sun.COM } 27007836SJohn.Forte@Sun.COM 27017836SJohn.Forte@Sun.COM break; 27027836SJohn.Forte@Sun.COM } 27037836SJohn.Forte@Sun.COM } 27047836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 27057836SJohn.Forte@Sun.COM return (status); 27067836SJohn.Forte@Sun.COM } 27077836SJohn.Forte@Sun.COM 27087836SJohn.Forte@Sun.COM 27097836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDefaultTime2WaitProperties( 27107836SJohn.Forte@Sun.COM IMA_OID lhbaId, 27117836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 27127836SJohn.Forte@Sun.COM IMA_GetDefaultTime2WaitPropertiesFn PassFunc; 27137836SJohn.Forte@Sun.COM IMA_UINT i; 27147836SJohn.Forte@Sun.COM IMA_STATUS status; 27157836SJohn.Forte@Sun.COM 27167836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 27177836SJohn.Forte@Sun.COM InitLibrary(); 27187836SJohn.Forte@Sun.COM 27197836SJohn.Forte@Sun.COM if (pProps == NULL) 27207836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 27217836SJohn.Forte@Sun.COM 27227836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 27237836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 27247836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 27257836SJohn.Forte@Sun.COM 27267836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 27277836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 27287836SJohn.Forte@Sun.COM 27297836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 27307836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 27317836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 27327836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 27337836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 27347836SJohn.Forte@Sun.COM #ifdef WIN32 27357836SJohn.Forte@Sun.COM PassFunc = 27367836SJohn.Forte@Sun.COM (IMA_GetDefaultTime2WaitPropertiesFn) 27377836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 27387836SJohn.Forte@Sun.COM "IMA_GetDefaultTime2WaitProperties"); 27397836SJohn.Forte@Sun.COM #else 27407836SJohn.Forte@Sun.COM PassFunc = 27417836SJohn.Forte@Sun.COM (IMA_GetDefaultTime2WaitPropertiesFn) 27427836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 27437836SJohn.Forte@Sun.COM "IMA_GetDefaultTime2WaitProperties"); 27447836SJohn.Forte@Sun.COM #endif 27457836SJohn.Forte@Sun.COM 27467836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 27477836SJohn.Forte@Sun.COM status = PassFunc(lhbaId, pProps); 27487836SJohn.Forte@Sun.COM } 27497836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 27507836SJohn.Forte@Sun.COM } 27517836SJohn.Forte@Sun.COM 27527836SJohn.Forte@Sun.COM break; 27537836SJohn.Forte@Sun.COM } 27547836SJohn.Forte@Sun.COM } 27557836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 27567836SJohn.Forte@Sun.COM return (status); 27577836SJohn.Forte@Sun.COM } 27587836SJohn.Forte@Sun.COM 27597836SJohn.Forte@Sun.COM 27607836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetDefaultTime2Wait( 27617836SJohn.Forte@Sun.COM IMA_OID lhbaId, 27627836SJohn.Forte@Sun.COM IMA_UINT defaultTime2Wait) { 27637836SJohn.Forte@Sun.COM IMA_SetDefaultTime2WaitFn PassFunc; 27647836SJohn.Forte@Sun.COM IMA_UINT i; 27657836SJohn.Forte@Sun.COM IMA_STATUS status; 27667836SJohn.Forte@Sun.COM 27677836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 27687836SJohn.Forte@Sun.COM InitLibrary(); 27697836SJohn.Forte@Sun.COM 27707836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 27717836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 27727836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 27737836SJohn.Forte@Sun.COM 27747836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 27757836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 27767836SJohn.Forte@Sun.COM 27777836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 27787836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 27797836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 27807836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 27817836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 27827836SJohn.Forte@Sun.COM #ifdef WIN32 27837836SJohn.Forte@Sun.COM PassFunc = 27847836SJohn.Forte@Sun.COM (IMA_SetDefaultTime2WaitFn) 27857836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 27867836SJohn.Forte@Sun.COM "IMA_SetDefaultTime2Wait"); 27877836SJohn.Forte@Sun.COM #else 27887836SJohn.Forte@Sun.COM PassFunc = 27897836SJohn.Forte@Sun.COM (IMA_SetDefaultTime2WaitFn) 27907836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 27917836SJohn.Forte@Sun.COM "IMA_SetDefaultTime2Wait"); 27927836SJohn.Forte@Sun.COM #endif 27937836SJohn.Forte@Sun.COM 27947836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 27957836SJohn.Forte@Sun.COM status = PassFunc( 27967836SJohn.Forte@Sun.COM lhbaId, defaultTime2Wait); 27977836SJohn.Forte@Sun.COM } 27987836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 27997836SJohn.Forte@Sun.COM } 28007836SJohn.Forte@Sun.COM 28017836SJohn.Forte@Sun.COM break; 28027836SJohn.Forte@Sun.COM } 28037836SJohn.Forte@Sun.COM } 28047836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 28057836SJohn.Forte@Sun.COM return (status); 28067836SJohn.Forte@Sun.COM } 28077836SJohn.Forte@Sun.COM 28087836SJohn.Forte@Sun.COM 28097836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetMaxOutstandingR2TProperties( 28107836SJohn.Forte@Sun.COM IMA_OID Oid, 28117836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 28127836SJohn.Forte@Sun.COM IMA_GetMaxOutstandingR2TPropertiesFn PassFunc; 28137836SJohn.Forte@Sun.COM IMA_UINT i; 28147836SJohn.Forte@Sun.COM IMA_STATUS status; 28157836SJohn.Forte@Sun.COM 28167836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 28177836SJohn.Forte@Sun.COM InitLibrary(); 28187836SJohn.Forte@Sun.COM 28197836SJohn.Forte@Sun.COM if (pProps == NULL) 28207836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 28217836SJohn.Forte@Sun.COM 28227836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 28237836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 28247836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 28257836SJohn.Forte@Sun.COM 28267836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 28277836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 28287836SJohn.Forte@Sun.COM 28297836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 28307836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 28317836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 28327836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 28337836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 28347836SJohn.Forte@Sun.COM #ifdef WIN32 28357836SJohn.Forte@Sun.COM PassFunc = 28367836SJohn.Forte@Sun.COM (IMA_GetMaxOutstandingR2TPropertiesFn) 28377836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 28387836SJohn.Forte@Sun.COM "IMA_GetMaxOutstandingR2TProperties"); 28397836SJohn.Forte@Sun.COM #else 28407836SJohn.Forte@Sun.COM PassFunc = 28417836SJohn.Forte@Sun.COM (IMA_GetMaxOutstandingR2TPropertiesFn) 28427836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 28437836SJohn.Forte@Sun.COM "IMA_GetMaxOutstandingR2TProperties"); 28447836SJohn.Forte@Sun.COM #endif 28457836SJohn.Forte@Sun.COM 28467836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 28477836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 28487836SJohn.Forte@Sun.COM } 28497836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 28507836SJohn.Forte@Sun.COM } 28517836SJohn.Forte@Sun.COM 28527836SJohn.Forte@Sun.COM break; 28537836SJohn.Forte@Sun.COM } 28547836SJohn.Forte@Sun.COM } 28557836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 28567836SJohn.Forte@Sun.COM return (status); 28577836SJohn.Forte@Sun.COM } 28587836SJohn.Forte@Sun.COM 28597836SJohn.Forte@Sun.COM 28607836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetMaxOutstandingR2T( 28617836SJohn.Forte@Sun.COM IMA_OID lhbaId, 28627836SJohn.Forte@Sun.COM IMA_UINT maxOutstandingR2T) { 28637836SJohn.Forte@Sun.COM IMA_SetMaxOutstandingR2TFn PassFunc; 28647836SJohn.Forte@Sun.COM IMA_UINT i; 28657836SJohn.Forte@Sun.COM IMA_STATUS status; 28667836SJohn.Forte@Sun.COM 28677836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 28687836SJohn.Forte@Sun.COM InitLibrary(); 28697836SJohn.Forte@Sun.COM 28707836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 28717836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 28727836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 28737836SJohn.Forte@Sun.COM 28747836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 28757836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 28767836SJohn.Forte@Sun.COM 28777836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 28787836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 28797836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 28807836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 28817836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 28827836SJohn.Forte@Sun.COM #ifdef WIN32 28837836SJohn.Forte@Sun.COM PassFunc = 28847836SJohn.Forte@Sun.COM (IMA_SetMaxOutstandingR2TFn) 28857836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 28867836SJohn.Forte@Sun.COM "IMA_SetMaxOutstandingR2T"); 28877836SJohn.Forte@Sun.COM #else 28887836SJohn.Forte@Sun.COM PassFunc = 28897836SJohn.Forte@Sun.COM (IMA_SetMaxOutstandingR2TFn) 28907836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 28917836SJohn.Forte@Sun.COM "IMA_SetMaxOutstandingR2T"); 28927836SJohn.Forte@Sun.COM #endif 28937836SJohn.Forte@Sun.COM 28947836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 28957836SJohn.Forte@Sun.COM status = PassFunc( 28967836SJohn.Forte@Sun.COM lhbaId, maxOutstandingR2T); 28977836SJohn.Forte@Sun.COM } 28987836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 28997836SJohn.Forte@Sun.COM } 29007836SJohn.Forte@Sun.COM 29017836SJohn.Forte@Sun.COM break; 29027836SJohn.Forte@Sun.COM } 29037836SJohn.Forte@Sun.COM } 29047836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 29057836SJohn.Forte@Sun.COM return (status); 29067836SJohn.Forte@Sun.COM } 29077836SJohn.Forte@Sun.COM 29087836SJohn.Forte@Sun.COM 29097836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetErrorRecoveryLevelProperties( 29107836SJohn.Forte@Sun.COM IMA_OID Oid, 29117836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 29127836SJohn.Forte@Sun.COM IMA_GetMaxOutstandingR2TPropertiesFn PassFunc; 29137836SJohn.Forte@Sun.COM IMA_UINT i; 29147836SJohn.Forte@Sun.COM IMA_STATUS status; 29157836SJohn.Forte@Sun.COM 29167836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 29177836SJohn.Forte@Sun.COM InitLibrary(); 29187836SJohn.Forte@Sun.COM 29197836SJohn.Forte@Sun.COM if (pProps == NULL) 29207836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 29217836SJohn.Forte@Sun.COM 29227836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 29237836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 29247836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 29257836SJohn.Forte@Sun.COM 29267836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 29277836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 29287836SJohn.Forte@Sun.COM 29297836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 29307836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 29317836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 29327836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 29337836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 29347836SJohn.Forte@Sun.COM #ifdef WIN32 29357836SJohn.Forte@Sun.COM PassFunc = 29367836SJohn.Forte@Sun.COM (IMA_GetErrorRecoveryLevelPropertiesFn) 29377836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 29387836SJohn.Forte@Sun.COM "IMA_GetErrorRecoveryLevelProperties"); 29397836SJohn.Forte@Sun.COM #else 29407836SJohn.Forte@Sun.COM PassFunc = 29417836SJohn.Forte@Sun.COM (IMA_GetErrorRecoveryLevelPropertiesFn) 29427836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 29437836SJohn.Forte@Sun.COM "IMA_GetErrorRecoveryLevelProperties"); 29447836SJohn.Forte@Sun.COM #endif 29457836SJohn.Forte@Sun.COM 29467836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 29477836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 29487836SJohn.Forte@Sun.COM } 29497836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 29507836SJohn.Forte@Sun.COM } 29517836SJohn.Forte@Sun.COM 29527836SJohn.Forte@Sun.COM break; 29537836SJohn.Forte@Sun.COM } 29547836SJohn.Forte@Sun.COM } 29557836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 29567836SJohn.Forte@Sun.COM return (status); 29577836SJohn.Forte@Sun.COM } 29587836SJohn.Forte@Sun.COM 29597836SJohn.Forte@Sun.COM 29607836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetErrorRecoveryLevel( 29617836SJohn.Forte@Sun.COM IMA_OID Oid, 29627836SJohn.Forte@Sun.COM IMA_UINT errorRecoveryLevel) { 29637836SJohn.Forte@Sun.COM IMA_SetErrorRecoveryLevelFn PassFunc; 29647836SJohn.Forte@Sun.COM IMA_UINT i; 29657836SJohn.Forte@Sun.COM IMA_STATUS status; 29667836SJohn.Forte@Sun.COM 29677836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 29687836SJohn.Forte@Sun.COM InitLibrary(); 29697836SJohn.Forte@Sun.COM 29707836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 29717836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 29727836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 29737836SJohn.Forte@Sun.COM 29747836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 29757836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 29767836SJohn.Forte@Sun.COM 29777836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 29787836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 29797836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 29807836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 29817836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 29827836SJohn.Forte@Sun.COM #ifdef WIN32 29837836SJohn.Forte@Sun.COM PassFunc = 29847836SJohn.Forte@Sun.COM (IMA_SetErrorRecoveryLevelFn) 29857836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 29867836SJohn.Forte@Sun.COM "IMA_SetErrorRecoveryLevel"); 29877836SJohn.Forte@Sun.COM #else 29887836SJohn.Forte@Sun.COM PassFunc = 29897836SJohn.Forte@Sun.COM (IMA_SetErrorRecoveryLevelFn) 29907836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 29917836SJohn.Forte@Sun.COM "IMA_SetErrorRecoveryLevel"); 29927836SJohn.Forte@Sun.COM #endif 29937836SJohn.Forte@Sun.COM 29947836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 29957836SJohn.Forte@Sun.COM status = PassFunc( 29967836SJohn.Forte@Sun.COM Oid, errorRecoveryLevel); 29977836SJohn.Forte@Sun.COM } 29987836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 29997836SJohn.Forte@Sun.COM } 30007836SJohn.Forte@Sun.COM 30017836SJohn.Forte@Sun.COM break; 30027836SJohn.Forte@Sun.COM } 30037836SJohn.Forte@Sun.COM } 30047836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 30057836SJohn.Forte@Sun.COM return (status); 30067836SJohn.Forte@Sun.COM } 30077836SJohn.Forte@Sun.COM 30087836SJohn.Forte@Sun.COM 30097836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetInitialR2TProperties( 30107836SJohn.Forte@Sun.COM IMA_OID Oid, 30117836SJohn.Forte@Sun.COM IMA_BOOL_VALUE *pProps) { 30127836SJohn.Forte@Sun.COM IMA_GetInitialR2TPropertiesFn PassFunc; 30137836SJohn.Forte@Sun.COM IMA_UINT i; 30147836SJohn.Forte@Sun.COM IMA_STATUS status; 30157836SJohn.Forte@Sun.COM 30167836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 30177836SJohn.Forte@Sun.COM InitLibrary(); 30187836SJohn.Forte@Sun.COM 30197836SJohn.Forte@Sun.COM if (pProps == NULL) 30207836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 30217836SJohn.Forte@Sun.COM 30227836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 30237836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 30247836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 30257836SJohn.Forte@Sun.COM 30267836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 30277836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 30287836SJohn.Forte@Sun.COM 30297836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 30307836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 30317836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 30327836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 30337836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 30347836SJohn.Forte@Sun.COM #ifdef WIN32 30357836SJohn.Forte@Sun.COM PassFunc = 30367836SJohn.Forte@Sun.COM (IMA_GetInitialR2TPropertiesFn) 30377836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 30387836SJohn.Forte@Sun.COM "IMA_GetInitialR2TProperties"); 30397836SJohn.Forte@Sun.COM #else 30407836SJohn.Forte@Sun.COM PassFunc = 30417836SJohn.Forte@Sun.COM (IMA_GetInitialR2TPropertiesFn) 30427836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 30437836SJohn.Forte@Sun.COM "IMA_GetInitialR2TProperties"); 30447836SJohn.Forte@Sun.COM #endif 30457836SJohn.Forte@Sun.COM 30467836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 30477836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 30487836SJohn.Forte@Sun.COM } 30497836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 30507836SJohn.Forte@Sun.COM } 30517836SJohn.Forte@Sun.COM 30527836SJohn.Forte@Sun.COM break; 30537836SJohn.Forte@Sun.COM } 30547836SJohn.Forte@Sun.COM } 30557836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 30567836SJohn.Forte@Sun.COM return (status); 30577836SJohn.Forte@Sun.COM } 30587836SJohn.Forte@Sun.COM 30597836SJohn.Forte@Sun.COM 30607836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetInitialR2T( 30617836SJohn.Forte@Sun.COM IMA_OID Oid, 30627836SJohn.Forte@Sun.COM IMA_BOOL initialR2T) 30637836SJohn.Forte@Sun.COM { 30647836SJohn.Forte@Sun.COM IMA_SetInitialR2TFn PassFunc; 30657836SJohn.Forte@Sun.COM IMA_UINT i; 30667836SJohn.Forte@Sun.COM IMA_STATUS status; 30677836SJohn.Forte@Sun.COM 30687836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 30697836SJohn.Forte@Sun.COM InitLibrary(); 30707836SJohn.Forte@Sun.COM 30717836SJohn.Forte@Sun.COM if (initialR2T != IMA_TRUE && 30727836SJohn.Forte@Sun.COM initialR2T != IMA_FALSE) 30737836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 30747836SJohn.Forte@Sun.COM 30757836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 30767836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 30777836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 30787836SJohn.Forte@Sun.COM 30797836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 30807836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 30817836SJohn.Forte@Sun.COM 30827836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 30837836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 30847836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 30857836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 30867836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 30877836SJohn.Forte@Sun.COM #ifdef WIN32 30887836SJohn.Forte@Sun.COM PassFunc = 30897836SJohn.Forte@Sun.COM (IMA_SetInitialR2TFn) GetProcAddress( 30907836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 30917836SJohn.Forte@Sun.COM "IMA_SetInitialR2T"); 30927836SJohn.Forte@Sun.COM #else 30937836SJohn.Forte@Sun.COM PassFunc = 30947836SJohn.Forte@Sun.COM (IMA_SetInitialR2TFn) 30957836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 30967836SJohn.Forte@Sun.COM "IMA_SetInitialR2T"); 30977836SJohn.Forte@Sun.COM #endif 30987836SJohn.Forte@Sun.COM 30997836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 31007836SJohn.Forte@Sun.COM status = PassFunc(Oid, initialR2T); 31017836SJohn.Forte@Sun.COM } 31027836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 31037836SJohn.Forte@Sun.COM } 31047836SJohn.Forte@Sun.COM 31057836SJohn.Forte@Sun.COM break; 31067836SJohn.Forte@Sun.COM } 31077836SJohn.Forte@Sun.COM } 31087836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 31097836SJohn.Forte@Sun.COM return (status); 31107836SJohn.Forte@Sun.COM } 31117836SJohn.Forte@Sun.COM 31127836SJohn.Forte@Sun.COM 31137836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetImmediateDataProperties( 31147836SJohn.Forte@Sun.COM IMA_OID Oid, 31157836SJohn.Forte@Sun.COM IMA_BOOL_VALUE *pProps) { 31167836SJohn.Forte@Sun.COM IMA_GetImmediateDataPropertiesFn PassFunc; 31177836SJohn.Forte@Sun.COM IMA_UINT i; 31187836SJohn.Forte@Sun.COM IMA_STATUS status; 31197836SJohn.Forte@Sun.COM 31207836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 31217836SJohn.Forte@Sun.COM InitLibrary(); 31227836SJohn.Forte@Sun.COM 31237836SJohn.Forte@Sun.COM if (pProps == NULL) 31247836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 31257836SJohn.Forte@Sun.COM 31267836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 31277836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 31287836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 31297836SJohn.Forte@Sun.COM 31307836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 31317836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 31327836SJohn.Forte@Sun.COM 31337836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 31347836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 31357836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 31367836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 31377836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 31387836SJohn.Forte@Sun.COM #ifdef WIN32 31397836SJohn.Forte@Sun.COM PassFunc = 31407836SJohn.Forte@Sun.COM (IMA_GetImmediateDataPropertiesFn) 31417836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 31427836SJohn.Forte@Sun.COM "IMA_GetImmediateDataProperties"); 31437836SJohn.Forte@Sun.COM #else 31447836SJohn.Forte@Sun.COM PassFunc = 31457836SJohn.Forte@Sun.COM (IMA_GetImmediateDataPropertiesFn) 31467836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 31477836SJohn.Forte@Sun.COM "IMA_GetImmediateDataProperties"); 31487836SJohn.Forte@Sun.COM #endif 31497836SJohn.Forte@Sun.COM 31507836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 31517836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 31527836SJohn.Forte@Sun.COM } 31537836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 31547836SJohn.Forte@Sun.COM } 31557836SJohn.Forte@Sun.COM 31567836SJohn.Forte@Sun.COM break; 31577836SJohn.Forte@Sun.COM } 31587836SJohn.Forte@Sun.COM } 31597836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 31607836SJohn.Forte@Sun.COM return (status); 31617836SJohn.Forte@Sun.COM } 31627836SJohn.Forte@Sun.COM 31637836SJohn.Forte@Sun.COM 31647836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetImmediateData( 31657836SJohn.Forte@Sun.COM IMA_OID Oid, 31667836SJohn.Forte@Sun.COM IMA_BOOL immediateData) { 31677836SJohn.Forte@Sun.COM IMA_SetImmediateDataFn PassFunc; 31687836SJohn.Forte@Sun.COM IMA_UINT i; 31697836SJohn.Forte@Sun.COM IMA_STATUS status; 31707836SJohn.Forte@Sun.COM 31717836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 31727836SJohn.Forte@Sun.COM InitLibrary(); 31737836SJohn.Forte@Sun.COM 31747836SJohn.Forte@Sun.COM if (immediateData != IMA_TRUE && 31757836SJohn.Forte@Sun.COM immediateData != IMA_FALSE) 31767836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 31777836SJohn.Forte@Sun.COM 31787836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 31797836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 31807836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 31817836SJohn.Forte@Sun.COM 31827836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 31837836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 31847836SJohn.Forte@Sun.COM 31857836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 31867836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 31877836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 31887836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 31897836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 31907836SJohn.Forte@Sun.COM #ifdef WIN32 31917836SJohn.Forte@Sun.COM PassFunc = 31927836SJohn.Forte@Sun.COM (IMA_SetImmediateDataFn) 31937836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 31947836SJohn.Forte@Sun.COM "IMA_SetImmediateData"); 31957836SJohn.Forte@Sun.COM #else 31967836SJohn.Forte@Sun.COM PassFunc = 31977836SJohn.Forte@Sun.COM (IMA_SetImmediateDataFn) 31987836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 31997836SJohn.Forte@Sun.COM "IMA_SetImmediateData"); 32007836SJohn.Forte@Sun.COM #endif 32017836SJohn.Forte@Sun.COM 32027836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 32037836SJohn.Forte@Sun.COM status = PassFunc(Oid, immediateData); 32047836SJohn.Forte@Sun.COM } 32057836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 32067836SJohn.Forte@Sun.COM } 32077836SJohn.Forte@Sun.COM 32087836SJohn.Forte@Sun.COM break; 32097836SJohn.Forte@Sun.COM } 32107836SJohn.Forte@Sun.COM } 32117836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 32127836SJohn.Forte@Sun.COM return (status); 32137836SJohn.Forte@Sun.COM } 32147836SJohn.Forte@Sun.COM 32157836SJohn.Forte@Sun.COM 32167836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDataPduInOrderProperties( 32177836SJohn.Forte@Sun.COM IMA_OID Oid, 32187836SJohn.Forte@Sun.COM IMA_BOOL_VALUE *pProps) { 32197836SJohn.Forte@Sun.COM IMA_GetDataPduInOrderPropertiesFn PassFunc; 32207836SJohn.Forte@Sun.COM IMA_UINT i; 32217836SJohn.Forte@Sun.COM IMA_STATUS status; 32227836SJohn.Forte@Sun.COM 32237836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 32247836SJohn.Forte@Sun.COM InitLibrary(); 32257836SJohn.Forte@Sun.COM 32267836SJohn.Forte@Sun.COM if (pProps == NULL) 32277836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 32287836SJohn.Forte@Sun.COM 32297836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 32307836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 32317836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 32327836SJohn.Forte@Sun.COM 32337836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 32347836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 32357836SJohn.Forte@Sun.COM 32367836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 32377836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 32387836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 32397836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 32407836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 32417836SJohn.Forte@Sun.COM #ifdef WIN32 32427836SJohn.Forte@Sun.COM PassFunc = 32437836SJohn.Forte@Sun.COM (IMA_GetDataPduInOrderPropertiesFn) 32447836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 32457836SJohn.Forte@Sun.COM "IMA_GetDataPduInOrderProperties"); 32467836SJohn.Forte@Sun.COM #else 32477836SJohn.Forte@Sun.COM PassFunc = 32487836SJohn.Forte@Sun.COM (IMA_GetDataPduInOrderPropertiesFn) 32497836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 32507836SJohn.Forte@Sun.COM "IMA_GetDataPduInOrderProperties"); 32517836SJohn.Forte@Sun.COM #endif 32527836SJohn.Forte@Sun.COM 32537836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 32547836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 32557836SJohn.Forte@Sun.COM } 32567836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 32577836SJohn.Forte@Sun.COM } 32587836SJohn.Forte@Sun.COM 32597836SJohn.Forte@Sun.COM break; 32607836SJohn.Forte@Sun.COM } 32617836SJohn.Forte@Sun.COM } 32627836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 32637836SJohn.Forte@Sun.COM return (status); 32647836SJohn.Forte@Sun.COM } 32657836SJohn.Forte@Sun.COM 32667836SJohn.Forte@Sun.COM 32677836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetDataPduInOrder( 32687836SJohn.Forte@Sun.COM IMA_OID Oid, 32697836SJohn.Forte@Sun.COM IMA_BOOL dataPduInOrder) { 32707836SJohn.Forte@Sun.COM IMA_SetDataPduInOrderFn PassFunc; 32717836SJohn.Forte@Sun.COM IMA_UINT i; 32727836SJohn.Forte@Sun.COM IMA_STATUS status; 32737836SJohn.Forte@Sun.COM 32747836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 32757836SJohn.Forte@Sun.COM InitLibrary(); 32767836SJohn.Forte@Sun.COM 32777836SJohn.Forte@Sun.COM if (dataPduInOrder != IMA_TRUE && 32787836SJohn.Forte@Sun.COM dataPduInOrder != IMA_FALSE) 32797836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 32807836SJohn.Forte@Sun.COM 32817836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 32827836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 32837836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 32847836SJohn.Forte@Sun.COM 32857836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 32867836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 32877836SJohn.Forte@Sun.COM 32887836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 32897836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 32907836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 32917836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 32927836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 32937836SJohn.Forte@Sun.COM #ifdef WIN32 32947836SJohn.Forte@Sun.COM PassFunc = 32957836SJohn.Forte@Sun.COM (IMA_SetDataPduInOrderFn) 32967836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 32977836SJohn.Forte@Sun.COM "IMA_SetDataPduInOrder"); 32987836SJohn.Forte@Sun.COM #else 32997836SJohn.Forte@Sun.COM PassFunc = 33007836SJohn.Forte@Sun.COM (IMA_SetDataPduInOrderFn) 33017836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 33027836SJohn.Forte@Sun.COM "IMA_SetDataPduInOrder"); 33037836SJohn.Forte@Sun.COM #endif 33047836SJohn.Forte@Sun.COM 33057836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 33067836SJohn.Forte@Sun.COM status = PassFunc(Oid, dataPduInOrder); 33077836SJohn.Forte@Sun.COM } 33087836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 33097836SJohn.Forte@Sun.COM } 33107836SJohn.Forte@Sun.COM 33117836SJohn.Forte@Sun.COM break; 33127836SJohn.Forte@Sun.COM } 33137836SJohn.Forte@Sun.COM } 33147836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 33157836SJohn.Forte@Sun.COM return (status); 33167836SJohn.Forte@Sun.COM } 33177836SJohn.Forte@Sun.COM 33187836SJohn.Forte@Sun.COM 33197836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDataSequenceInOrderProperties( 33207836SJohn.Forte@Sun.COM IMA_OID Oid, 33217836SJohn.Forte@Sun.COM IMA_BOOL_VALUE *pProps) { 33227836SJohn.Forte@Sun.COM IMA_GetDataSequenceInOrderPropertiesFn PassFunc; 33237836SJohn.Forte@Sun.COM IMA_UINT i; 33247836SJohn.Forte@Sun.COM IMA_STATUS status; 33257836SJohn.Forte@Sun.COM 33267836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 33277836SJohn.Forte@Sun.COM InitLibrary(); 33287836SJohn.Forte@Sun.COM 33297836SJohn.Forte@Sun.COM if (pProps == NULL) 33307836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 33317836SJohn.Forte@Sun.COM 33327836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 33337836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 33347836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 33357836SJohn.Forte@Sun.COM 33367836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 33377836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 33387836SJohn.Forte@Sun.COM 33397836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 33407836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 33417836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 33427836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 33437836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 33447836SJohn.Forte@Sun.COM #ifdef WIN32 33457836SJohn.Forte@Sun.COM PassFunc = 33467836SJohn.Forte@Sun.COM (IMA_GetDataSequenceInOrderPropertiesFn) 33477836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 33487836SJohn.Forte@Sun.COM "IMA_GetDataSequenceInOrderProperties"); 33497836SJohn.Forte@Sun.COM #else 33507836SJohn.Forte@Sun.COM PassFunc = 33517836SJohn.Forte@Sun.COM (IMA_GetDataSequenceInOrderPropertiesFn) 33527836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 33537836SJohn.Forte@Sun.COM "IMA_GetDataSequenceInOrderProperties"); 33547836SJohn.Forte@Sun.COM #endif 33557836SJohn.Forte@Sun.COM 33567836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 33577836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 33587836SJohn.Forte@Sun.COM } 33597836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 33607836SJohn.Forte@Sun.COM } 33617836SJohn.Forte@Sun.COM 33627836SJohn.Forte@Sun.COM break; 33637836SJohn.Forte@Sun.COM } 33647836SJohn.Forte@Sun.COM } 33657836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 33667836SJohn.Forte@Sun.COM return (status); 33677836SJohn.Forte@Sun.COM } 33687836SJohn.Forte@Sun.COM 33697836SJohn.Forte@Sun.COM 33707836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetDataSequenceInOrder( 33717836SJohn.Forte@Sun.COM IMA_OID Oid, 33727836SJohn.Forte@Sun.COM IMA_BOOL dataSequenceInOrder) { 33737836SJohn.Forte@Sun.COM IMA_SetDataSequenceInOrderFn PassFunc; 33747836SJohn.Forte@Sun.COM IMA_UINT i; 33757836SJohn.Forte@Sun.COM IMA_STATUS status; 33767836SJohn.Forte@Sun.COM 33777836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 33787836SJohn.Forte@Sun.COM InitLibrary(); 33797836SJohn.Forte@Sun.COM 33807836SJohn.Forte@Sun.COM if (dataSequenceInOrder != IMA_TRUE && 33817836SJohn.Forte@Sun.COM dataSequenceInOrder != IMA_FALSE) 33827836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 33837836SJohn.Forte@Sun.COM 33847836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 33857836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 33867836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 33877836SJohn.Forte@Sun.COM 33887836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 33897836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 33907836SJohn.Forte@Sun.COM 33917836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 33927836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 33937836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 33947836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 33957836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 33967836SJohn.Forte@Sun.COM #ifdef WIN32 33977836SJohn.Forte@Sun.COM PassFunc = 33987836SJohn.Forte@Sun.COM (IMA_SetDataSequenceInOrderFn) 33997836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 34007836SJohn.Forte@Sun.COM "IMA_SetDataSequenceInOrder"); 34017836SJohn.Forte@Sun.COM #else 34027836SJohn.Forte@Sun.COM PassFunc = 34037836SJohn.Forte@Sun.COM (IMA_SetDataSequenceInOrderFn) 34047836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 34057836SJohn.Forte@Sun.COM "IMA_SetDataSequenceInOrder"); 34067836SJohn.Forte@Sun.COM #endif 34077836SJohn.Forte@Sun.COM 34087836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 34097836SJohn.Forte@Sun.COM status = PassFunc( 34107836SJohn.Forte@Sun.COM Oid, dataSequenceInOrder); 34117836SJohn.Forte@Sun.COM } 34127836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 34137836SJohn.Forte@Sun.COM } 34147836SJohn.Forte@Sun.COM 34157836SJohn.Forte@Sun.COM break; 34167836SJohn.Forte@Sun.COM } 34177836SJohn.Forte@Sun.COM } 34187836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 34197836SJohn.Forte@Sun.COM return (status); 34207836SJohn.Forte@Sun.COM } 34217836SJohn.Forte@Sun.COM 34227836SJohn.Forte@Sun.COM 34237836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetStatisticsCollection( 34247836SJohn.Forte@Sun.COM IMA_OID Oid, 34257836SJohn.Forte@Sun.COM IMA_BOOL enableStatisticsCollection) { 34267836SJohn.Forte@Sun.COM IMA_SetStatisticsCollectionFn PassFunc; 34277836SJohn.Forte@Sun.COM IMA_UINT i; 34287836SJohn.Forte@Sun.COM IMA_STATUS status; 34297836SJohn.Forte@Sun.COM 34307836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 34317836SJohn.Forte@Sun.COM InitLibrary(); 34327836SJohn.Forte@Sun.COM 34337836SJohn.Forte@Sun.COM if (enableStatisticsCollection != IMA_TRUE && 34347836SJohn.Forte@Sun.COM enableStatisticsCollection != IMA_FALSE) 34357836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 34367836SJohn.Forte@Sun.COM 34377836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_PHBA && 34387836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 34397836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 34407836SJohn.Forte@Sun.COM 34417836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 34427836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 34437836SJohn.Forte@Sun.COM 34447836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 34457836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 34467836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 34477836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 34487836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 34497836SJohn.Forte@Sun.COM #ifdef WIN32 34507836SJohn.Forte@Sun.COM PassFunc = 34517836SJohn.Forte@Sun.COM (IMA_SetStatisticsCollectionFn) 34527836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 34537836SJohn.Forte@Sun.COM "IMA_SetStatisticsCollection"); 34547836SJohn.Forte@Sun.COM #else 34557836SJohn.Forte@Sun.COM PassFunc = 34567836SJohn.Forte@Sun.COM (IMA_SetStatisticsCollectionFn) 34577836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 34587836SJohn.Forte@Sun.COM "IMA_SetStatisticsCollection"); 34597836SJohn.Forte@Sun.COM #endif 34607836SJohn.Forte@Sun.COM 34617836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 34627836SJohn.Forte@Sun.COM status = PassFunc( 34637836SJohn.Forte@Sun.COM Oid, enableStatisticsCollection); 34647836SJohn.Forte@Sun.COM } 34657836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 34667836SJohn.Forte@Sun.COM } 34677836SJohn.Forte@Sun.COM 34687836SJohn.Forte@Sun.COM break; 34697836SJohn.Forte@Sun.COM } 34707836SJohn.Forte@Sun.COM } 34717836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 34727836SJohn.Forte@Sun.COM return (status); 34737836SJohn.Forte@Sun.COM } 34747836SJohn.Forte@Sun.COM 34757836SJohn.Forte@Sun.COM 34767836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetNetworkPortStatus( 34777836SJohn.Forte@Sun.COM IMA_OID portOid, 34787836SJohn.Forte@Sun.COM IMA_NETWORK_PORT_STATUS *pStatus) { 34797836SJohn.Forte@Sun.COM IMA_GetNetworkPortStatusFn PassFunc; 34807836SJohn.Forte@Sun.COM IMA_UINT i; 34817836SJohn.Forte@Sun.COM IMA_STATUS status; 34827836SJohn.Forte@Sun.COM 34837836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 34847836SJohn.Forte@Sun.COM InitLibrary(); 34857836SJohn.Forte@Sun.COM 34867836SJohn.Forte@Sun.COM if (pStatus == NULL) 34877836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 34887836SJohn.Forte@Sun.COM 34897836SJohn.Forte@Sun.COM if (portOid.objectType != IMA_OBJECT_TYPE_PNP && 34907836SJohn.Forte@Sun.COM portOid.objectType != IMA_OBJECT_TYPE_LNP) 34917836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 34927836SJohn.Forte@Sun.COM 34937836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 34947836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 34957836SJohn.Forte@Sun.COM 34967836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 34977836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == portOid.ownerId) { 34987836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 34997836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 35007836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 35017836SJohn.Forte@Sun.COM #ifdef WIN32 35027836SJohn.Forte@Sun.COM PassFunc = 35037836SJohn.Forte@Sun.COM (IMA_GetNetworkPortStatusFn) 35047836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 35057836SJohn.Forte@Sun.COM "IMA_GetNetworkPortStatus"); 35067836SJohn.Forte@Sun.COM #else 35077836SJohn.Forte@Sun.COM PassFunc = 35087836SJohn.Forte@Sun.COM (IMA_GetNetworkPortStatusFn) 35097836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 35107836SJohn.Forte@Sun.COM "IMA_GetNetworkPortStatus"); 35117836SJohn.Forte@Sun.COM #endif 35127836SJohn.Forte@Sun.COM 35137836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 35147836SJohn.Forte@Sun.COM status = PassFunc(portOid, pStatus); 35157836SJohn.Forte@Sun.COM } 35167836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 35177836SJohn.Forte@Sun.COM } 35187836SJohn.Forte@Sun.COM 35197836SJohn.Forte@Sun.COM break; 35207836SJohn.Forte@Sun.COM } 35217836SJohn.Forte@Sun.COM } 35227836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 35237836SJohn.Forte@Sun.COM return (status); 35247836SJohn.Forte@Sun.COM } 35257836SJohn.Forte@Sun.COM 35267836SJohn.Forte@Sun.COM 35277836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetTargetOidList( 35287836SJohn.Forte@Sun.COM IMA_OID Oid, 35297836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 35307836SJohn.Forte@Sun.COM IMA_GetTargetOidListFn PassFunc; 35317836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 35327836SJohn.Forte@Sun.COM IMA_UINT i; 35337836SJohn.Forte@Sun.COM IMA_STATUS status; 35347836SJohn.Forte@Sun.COM 35357836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 35367836SJohn.Forte@Sun.COM InitLibrary(); 35377836SJohn.Forte@Sun.COM 35387836SJohn.Forte@Sun.COM if (ppList == NULL) 35397836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 35407836SJohn.Forte@Sun.COM 35417836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 35427836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_LNP) 35437836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 35447836SJohn.Forte@Sun.COM 35457836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 35467836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 35477836SJohn.Forte@Sun.COM 35487836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 35497836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 35507836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 35517836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 35527836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 35537836SJohn.Forte@Sun.COM #ifdef WIN32 35547836SJohn.Forte@Sun.COM PassFunc = 35557836SJohn.Forte@Sun.COM (IMA_GetTargetOidListFn) 35567836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 35577836SJohn.Forte@Sun.COM "IMA_GetTargetOidList"); 35587836SJohn.Forte@Sun.COM #else 35597836SJohn.Forte@Sun.COM PassFunc = 35607836SJohn.Forte@Sun.COM (IMA_GetTargetOidListFn) 35617836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 35627836SJohn.Forte@Sun.COM "IMA_GetTargetOidList"); 35637836SJohn.Forte@Sun.COM #endif 35647836SJohn.Forte@Sun.COM 35657836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 35667836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 35677836SJohn.Forte@Sun.COM IMA_UINT listSize; 35687836SJohn.Forte@Sun.COM listSize = sizeof (IMA_OID_LIST); 35697836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 35707836SJohn.Forte@Sun.COM if (IMA_SUCCESS(status)) { 35717836SJohn.Forte@Sun.COM *ppList = 35727836SJohn.Forte@Sun.COM (IMA_OID_LIST*)calloc(1, 35737836SJohn.Forte@Sun.COM sizeof (IMA_OID_LIST) + 35747836SJohn.Forte@Sun.COM ((ppOidList->oidCount - 1)* 35757836SJohn.Forte@Sun.COM sizeof (IMA_OID))); 35767836SJohn.Forte@Sun.COM 35777836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 35787836SJohn.Forte@Sun.COM return (EUOS_ERROR); 35797836SJohn.Forte@Sun.COM } 35807836SJohn.Forte@Sun.COM else 35817836SJohn.Forte@Sun.COM memcpy((*ppList), 35827836SJohn.Forte@Sun.COM ppOidList, listSize 35837836SJohn.Forte@Sun.COM + (ppOidList-> 35847836SJohn.Forte@Sun.COM oidCount - 1)* 35857836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 35867836SJohn.Forte@Sun.COM #ifdef WIN32 35877836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 35887836SJohn.Forte@Sun.COM GetProcAddress( 35897836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 35907836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 35917836SJohn.Forte@Sun.COM #else 35927836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 35937836SJohn.Forte@Sun.COM dlsym( 35947836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 35957836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 35967836SJohn.Forte@Sun.COM #endif 35977836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 35987836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 35997836SJohn.Forte@Sun.COM } 36007836SJohn.Forte@Sun.COM } 36017836SJohn.Forte@Sun.COM } 36027836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 36037836SJohn.Forte@Sun.COM } 36047836SJohn.Forte@Sun.COM 36057836SJohn.Forte@Sun.COM break; 36067836SJohn.Forte@Sun.COM } 36077836SJohn.Forte@Sun.COM } 36087836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 36097836SJohn.Forte@Sun.COM return (status); 36107836SJohn.Forte@Sun.COM } 36117836SJohn.Forte@Sun.COM 36127836SJohn.Forte@Sun.COM 36137836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_RemoveStaleData( 36147836SJohn.Forte@Sun.COM IMA_OID lhbaId) { 36157836SJohn.Forte@Sun.COM IMA_RemoveStaleDataFn PassFunc; 36167836SJohn.Forte@Sun.COM IMA_UINT i; 36177836SJohn.Forte@Sun.COM IMA_STATUS status; 36187836SJohn.Forte@Sun.COM 36197836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 36207836SJohn.Forte@Sun.COM InitLibrary(); 36217836SJohn.Forte@Sun.COM 36227836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA) 36237836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 36247836SJohn.Forte@Sun.COM 36257836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 36267836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 36277836SJohn.Forte@Sun.COM 36287836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 36297836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 36307836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 36317836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 36327836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 36337836SJohn.Forte@Sun.COM #ifdef WIN32 36347836SJohn.Forte@Sun.COM PassFunc = (IMA_RemoveStaleDataFn) 36357836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 36367836SJohn.Forte@Sun.COM "IMA_RemoveStaleData"); 36377836SJohn.Forte@Sun.COM #else 36387836SJohn.Forte@Sun.COM PassFunc = (IMA_RemoveStaleDataFn) 36397836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 36407836SJohn.Forte@Sun.COM "IMA_RemoveStaleData"); 36417836SJohn.Forte@Sun.COM #endif 36427836SJohn.Forte@Sun.COM 36437836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 36447836SJohn.Forte@Sun.COM status = PassFunc(lhbaId); 36457836SJohn.Forte@Sun.COM } 36467836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 36477836SJohn.Forte@Sun.COM } 36487836SJohn.Forte@Sun.COM 36497836SJohn.Forte@Sun.COM break; 36507836SJohn.Forte@Sun.COM } 36517836SJohn.Forte@Sun.COM } 36527836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 36537836SJohn.Forte@Sun.COM return (status); 36547836SJohn.Forte@Sun.COM } 36557836SJohn.Forte@Sun.COM 36567836SJohn.Forte@Sun.COM 36577836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetIsnsDiscovery( 36587836SJohn.Forte@Sun.COM IMA_OID phbaId, 36597836SJohn.Forte@Sun.COM IMA_BOOL enableIsnsDiscovery, 36607836SJohn.Forte@Sun.COM IMA_ISNS_DISCOVERY_METHOD discoveryMethod, 36617836SJohn.Forte@Sun.COM const IMA_HOST_ID *iSnsHost) { 36627836SJohn.Forte@Sun.COM IMA_SetIsnsDiscoveryFn PassFunc; 36637836SJohn.Forte@Sun.COM IMA_UINT i; 36647836SJohn.Forte@Sun.COM IMA_STATUS status; 36657836SJohn.Forte@Sun.COM 36667836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 36677836SJohn.Forte@Sun.COM InitLibrary(); 36687836SJohn.Forte@Sun.COM 36697836SJohn.Forte@Sun.COM if (enableIsnsDiscovery != IMA_TRUE && 36707836SJohn.Forte@Sun.COM enableIsnsDiscovery != IMA_FALSE) 36717836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 36727836SJohn.Forte@Sun.COM 36737836SJohn.Forte@Sun.COM if (enableIsnsDiscovery == IMA_TRUE && iSnsHost == NULL) 36747836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 36757836SJohn.Forte@Sun.COM 36767836SJohn.Forte@Sun.COM if (discoveryMethod != IMA_ISNS_DISCOVERY_METHOD_STATIC && 36777836SJohn.Forte@Sun.COM discoveryMethod != IMA_ISNS_DISCOVERY_METHOD_DHCP && 36787836SJohn.Forte@Sun.COM discoveryMethod != IMA_ISNS_DISCOVERY_METHOD_SLP) 36797836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 36807836SJohn.Forte@Sun.COM 36817836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA && 36827836SJohn.Forte@Sun.COM phbaId.objectType != IMA_OBJECT_TYPE_LHBA) { 36837836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 36847836SJohn.Forte@Sun.COM } 36857836SJohn.Forte@Sun.COM 36867836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 36877836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 36887836SJohn.Forte@Sun.COM 36897836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 36907836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 36917836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 36927836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 36937836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 36947836SJohn.Forte@Sun.COM #ifdef WIN32 36957836SJohn.Forte@Sun.COM PassFunc = 36967836SJohn.Forte@Sun.COM (IMA_SetIsnsDiscoveryFn) 36977836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 36987836SJohn.Forte@Sun.COM "IMA_SetIsnsDiscovery"); 36997836SJohn.Forte@Sun.COM #else 37007836SJohn.Forte@Sun.COM PassFunc = 37017836SJohn.Forte@Sun.COM (IMA_SetIsnsDiscoveryFn) 37027836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 37037836SJohn.Forte@Sun.COM "IMA_SetIsnsDiscovery"); 37047836SJohn.Forte@Sun.COM #endif 37057836SJohn.Forte@Sun.COM 37067836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 37077836SJohn.Forte@Sun.COM status = PassFunc(phbaId, 37087836SJohn.Forte@Sun.COM enableIsnsDiscovery, 37097836SJohn.Forte@Sun.COM discoveryMethod, iSnsHost); 37107836SJohn.Forte@Sun.COM } 37117836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 37127836SJohn.Forte@Sun.COM } 37137836SJohn.Forte@Sun.COM 37147836SJohn.Forte@Sun.COM break; 37157836SJohn.Forte@Sun.COM } 37167836SJohn.Forte@Sun.COM } 37177836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 37187836SJohn.Forte@Sun.COM return (status); 37197836SJohn.Forte@Sun.COM } 37207836SJohn.Forte@Sun.COM 37217836SJohn.Forte@Sun.COM 37227836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetSlpDiscovery( 37237836SJohn.Forte@Sun.COM IMA_OID phbaId, 37247836SJohn.Forte@Sun.COM IMA_BOOL enableSlpDiscovery) { 37257836SJohn.Forte@Sun.COM IMA_SetSlpDiscoveryFn PassFunc; 37267836SJohn.Forte@Sun.COM IMA_UINT i; 37277836SJohn.Forte@Sun.COM IMA_STATUS status; 37287836SJohn.Forte@Sun.COM 37297836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 37307836SJohn.Forte@Sun.COM InitLibrary(); 37317836SJohn.Forte@Sun.COM 37327836SJohn.Forte@Sun.COM if (enableSlpDiscovery != IMA_TRUE && 37337836SJohn.Forte@Sun.COM enableSlpDiscovery != IMA_FALSE) 37347836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 37357836SJohn.Forte@Sun.COM 37367836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA && 37377836SJohn.Forte@Sun.COM phbaId.objectType != IMA_OBJECT_TYPE_LHBA) 37387836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 37397836SJohn.Forte@Sun.COM 37407836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 37417836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 37427836SJohn.Forte@Sun.COM 37437836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 37447836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 37457836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 37467836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 37477836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 37487836SJohn.Forte@Sun.COM #ifdef WIN32 37497836SJohn.Forte@Sun.COM PassFunc = 37507836SJohn.Forte@Sun.COM (IMA_SetSlpDiscoveryFn) 37517836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 37527836SJohn.Forte@Sun.COM "IMA_SetSlpDiscovery"); 37537836SJohn.Forte@Sun.COM #else 37547836SJohn.Forte@Sun.COM PassFunc = (IMA_SetSlpDiscoveryFn) 37557836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 37567836SJohn.Forte@Sun.COM "IMA_SetSlpDiscovery"); 37577836SJohn.Forte@Sun.COM #endif 37587836SJohn.Forte@Sun.COM 37597836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 37607836SJohn.Forte@Sun.COM status = PassFunc( 37617836SJohn.Forte@Sun.COM phbaId, 37627836SJohn.Forte@Sun.COM enableSlpDiscovery); 37637836SJohn.Forte@Sun.COM } 37647836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 37657836SJohn.Forte@Sun.COM } 37667836SJohn.Forte@Sun.COM 37677836SJohn.Forte@Sun.COM break; 37687836SJohn.Forte@Sun.COM } 37697836SJohn.Forte@Sun.COM } 37707836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 37717836SJohn.Forte@Sun.COM return (status); 37727836SJohn.Forte@Sun.COM } 37737836SJohn.Forte@Sun.COM 37747836SJohn.Forte@Sun.COM 37757836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetStaticDiscovery( 37767836SJohn.Forte@Sun.COM IMA_OID phbaId, 37777836SJohn.Forte@Sun.COM IMA_BOOL enableStaticDiscovery) { 37787836SJohn.Forte@Sun.COM IMA_SetStaticDiscoveryFn PassFunc; 37797836SJohn.Forte@Sun.COM IMA_UINT i; 37807836SJohn.Forte@Sun.COM IMA_STATUS status; 37817836SJohn.Forte@Sun.COM 37827836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 37837836SJohn.Forte@Sun.COM InitLibrary(); 37847836SJohn.Forte@Sun.COM 37857836SJohn.Forte@Sun.COM if (enableStaticDiscovery != IMA_TRUE && 37867836SJohn.Forte@Sun.COM enableStaticDiscovery != IMA_FALSE) 37877836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 37887836SJohn.Forte@Sun.COM 37897836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA && 37907836SJohn.Forte@Sun.COM phbaId.objectType != IMA_OBJECT_TYPE_LHBA) 37917836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 37927836SJohn.Forte@Sun.COM 37937836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 37947836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 37957836SJohn.Forte@Sun.COM 37967836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 37977836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 37987836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 37997836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 38007836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 38017836SJohn.Forte@Sun.COM #ifdef WIN32 38027836SJohn.Forte@Sun.COM PassFunc = (IMA_SetStaticDiscoveryFn) 38037836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 38047836SJohn.Forte@Sun.COM "IMA_SetStaticDiscovery"); 38057836SJohn.Forte@Sun.COM #else 38067836SJohn.Forte@Sun.COM PassFunc = (IMA_SetStaticDiscoveryFn) 38077836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 38087836SJohn.Forte@Sun.COM "IMA_SetStaticDiscovery"); 38097836SJohn.Forte@Sun.COM #endif 38107836SJohn.Forte@Sun.COM 38117836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 38127836SJohn.Forte@Sun.COM status = PassFunc( 38137836SJohn.Forte@Sun.COM phbaId, 38147836SJohn.Forte@Sun.COM enableStaticDiscovery); 38157836SJohn.Forte@Sun.COM } 38167836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 38177836SJohn.Forte@Sun.COM } 38187836SJohn.Forte@Sun.COM 38197836SJohn.Forte@Sun.COM break; 38207836SJohn.Forte@Sun.COM } 38217836SJohn.Forte@Sun.COM } 38227836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 38237836SJohn.Forte@Sun.COM return (status); 38247836SJohn.Forte@Sun.COM } 38257836SJohn.Forte@Sun.COM 38267836SJohn.Forte@Sun.COM 38277836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetSendTargetsDiscovery( 38287836SJohn.Forte@Sun.COM IMA_OID phbaId, 38297836SJohn.Forte@Sun.COM IMA_BOOL enableSendTargetsDiscovery) { 38307836SJohn.Forte@Sun.COM IMA_SetSendTargetsDiscoveryFn PassFunc; 38317836SJohn.Forte@Sun.COM IMA_UINT i; 38327836SJohn.Forte@Sun.COM IMA_STATUS status; 38337836SJohn.Forte@Sun.COM 38347836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 38357836SJohn.Forte@Sun.COM InitLibrary(); 38367836SJohn.Forte@Sun.COM 38377836SJohn.Forte@Sun.COM if (enableSendTargetsDiscovery != IMA_TRUE && 38387836SJohn.Forte@Sun.COM enableSendTargetsDiscovery != IMA_FALSE) 38397836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 38407836SJohn.Forte@Sun.COM 38417836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA && 38427836SJohn.Forte@Sun.COM phbaId.objectType != IMA_OBJECT_TYPE_LHBA) { 38437836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 38447836SJohn.Forte@Sun.COM } 38457836SJohn.Forte@Sun.COM 38467836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 38477836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 38487836SJohn.Forte@Sun.COM 38497836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 38507836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 38517836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 38527836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 38537836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 38547836SJohn.Forte@Sun.COM #ifdef WIN32 38557836SJohn.Forte@Sun.COM PassFunc = (IMA_SetSendTargetsDiscoveryFn) 38567836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 38577836SJohn.Forte@Sun.COM "IMA_SetSendTargetsDiscovery"); 38587836SJohn.Forte@Sun.COM #else 38597836SJohn.Forte@Sun.COM PassFunc = (IMA_SetSendTargetsDiscoveryFn) 38607836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 38617836SJohn.Forte@Sun.COM "IMA_SetSendTargetsDiscovery"); 38627836SJohn.Forte@Sun.COM #endif 38637836SJohn.Forte@Sun.COM 38647836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 38657836SJohn.Forte@Sun.COM status = PassFunc( 38667836SJohn.Forte@Sun.COM phbaId, 38677836SJohn.Forte@Sun.COM enableSendTargetsDiscovery); 38687836SJohn.Forte@Sun.COM } 38697836SJohn.Forte@Sun.COM os_releasemutex( 38707836SJohn.Forte@Sun.COM plugintable[i].pluginMutex); 38717836SJohn.Forte@Sun.COM } 38727836SJohn.Forte@Sun.COM 38737836SJohn.Forte@Sun.COM break; 38747836SJohn.Forte@Sun.COM } 38757836SJohn.Forte@Sun.COM } 38767836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 38777836SJohn.Forte@Sun.COM return (status); 38787836SJohn.Forte@Sun.COM } 38797836SJohn.Forte@Sun.COM 38807836SJohn.Forte@Sun.COM /* 38817836SJohn.Forte@Sun.COM * this forces plugins to rescan all iscsi targets on this 38827836SJohn.Forte@Sun.COM * ipaddress/port and return a 38837836SJohn.Forte@Sun.COM * list of discovered targets. 38847836SJohn.Forte@Sun.COM * ERROR/todo: 38857836SJohn.Forte@Sun.COM * according to IMA spec., pTargetOidList is allocated by 38867836SJohn.Forte@Sun.COM * the caller for library to return data, 38877836SJohn.Forte@Sun.COM * how does a caller know how much space it will be? 38887836SJohn.Forte@Sun.COM * pTargetOidList should be allocated by the library/plugin 38897836SJohn.Forte@Sun.COM * like IMA_GetLnpOidList 38907836SJohn.Forte@Sun.COM */ 38917836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_AddPhbaStaticDiscoveryTarget( 38927836SJohn.Forte@Sun.COM IMA_OID phbaOid, 38937836SJohn.Forte@Sun.COM const IMA_TARGET_ADDRESS targetAddress, 38947836SJohn.Forte@Sun.COM IMA_OID_LIST **pTargetOidList) { 38957836SJohn.Forte@Sun.COM IMA_AddPhbaStaticDiscoveryTargetFn PassFunc; 38967836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 38977836SJohn.Forte@Sun.COM IMA_UINT i; 38987836SJohn.Forte@Sun.COM IMA_STATUS status; 38997836SJohn.Forte@Sun.COM 39007836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 39017836SJohn.Forte@Sun.COM InitLibrary(); 39027836SJohn.Forte@Sun.COM 39037836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 39047836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 39057836SJohn.Forte@Sun.COM 39067836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 39077836SJohn.Forte@Sun.COM 39087836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaOid.ownerId) { 39097836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 39107836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 39117836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 39127836SJohn.Forte@Sun.COM #ifdef WIN32 39137836SJohn.Forte@Sun.COM PassFunc = 39147836SJohn.Forte@Sun.COM (IMA_AddPhbaStaticDiscoveryTargetFn) 39157836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 39167836SJohn.Forte@Sun.COM "IMA_AddPhbaStaticDiscoveryTarget"); 39177836SJohn.Forte@Sun.COM #else 39187836SJohn.Forte@Sun.COM PassFunc = 39197836SJohn.Forte@Sun.COM (IMA_AddPhbaStaticDiscoveryTargetFn) 39207836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 39217836SJohn.Forte@Sun.COM "IMA_AddPhbaStaticDiscoveryTarget"); 39227836SJohn.Forte@Sun.COM #endif 39237836SJohn.Forte@Sun.COM 39247836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 39257836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 39267836SJohn.Forte@Sun.COM IMA_UINT listSize; 39277836SJohn.Forte@Sun.COM listSize = 39287836SJohn.Forte@Sun.COM sizeof (IMA_OID_LIST); 39297836SJohn.Forte@Sun.COM status = PassFunc(phbaOid, 39307836SJohn.Forte@Sun.COM targetAddress, &ppOidList); 39317836SJohn.Forte@Sun.COM if (IMA_SUCCESS(status)) { 39327836SJohn.Forte@Sun.COM 39337836SJohn.Forte@Sun.COM (*pTargetOidList) = 39347836SJohn.Forte@Sun.COM (IMA_OID_LIST*) 39357836SJohn.Forte@Sun.COM calloc(1, listSize + 39367836SJohn.Forte@Sun.COM (ppOidList->oidCount-1)* 39377836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 39387836SJohn.Forte@Sun.COM 39397836SJohn.Forte@Sun.COM if ((*pTargetOidList) == NULL) { 39407836SJohn.Forte@Sun.COM status = 39417836SJohn.Forte@Sun.COM EUOS_ERROR; 39427836SJohn.Forte@Sun.COM } 39437836SJohn.Forte@Sun.COM memcpy((*pTargetOidList), 39447836SJohn.Forte@Sun.COM ppOidList, 39457836SJohn.Forte@Sun.COM listSize + 39467836SJohn.Forte@Sun.COM (ppOidList->oidCount-1)* 39477836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 39487836SJohn.Forte@Sun.COM #ifdef WIN32 39497836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 39507836SJohn.Forte@Sun.COM GetProcAddress( 39517836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 39527836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 39537836SJohn.Forte@Sun.COM #else 39547836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 39557836SJohn.Forte@Sun.COM dlsym( 39567836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 39577836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 39587836SJohn.Forte@Sun.COM #endif 39597836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 39607836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 39617836SJohn.Forte@Sun.COM } 39627836SJohn.Forte@Sun.COM } 39637836SJohn.Forte@Sun.COM } 39647836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 39657836SJohn.Forte@Sun.COM } 39667836SJohn.Forte@Sun.COM 39677836SJohn.Forte@Sun.COM break; 39687836SJohn.Forte@Sun.COM } 39697836SJohn.Forte@Sun.COM } 39707836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 39717836SJohn.Forte@Sun.COM return (status); 39727836SJohn.Forte@Sun.COM } 39737836SJohn.Forte@Sun.COM 39747836SJohn.Forte@Sun.COM 39757836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_RemovePhbaStaticDiscoveryTarget( 39767836SJohn.Forte@Sun.COM IMA_OID phbaOid, 39777836SJohn.Forte@Sun.COM IMA_OID targetOid) { 39787836SJohn.Forte@Sun.COM IMA_RemovePhbaStaticDiscoveryTargetFn PassFunc; 39797836SJohn.Forte@Sun.COM IMA_UINT i; 39807836SJohn.Forte@Sun.COM IMA_STATUS status; 39817836SJohn.Forte@Sun.COM 39827836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 39837836SJohn.Forte@Sun.COM InitLibrary(); 39847836SJohn.Forte@Sun.COM 39857836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 39867836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 39877836SJohn.Forte@Sun.COM 39887836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 39897836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == targetOid.ownerId) { 39907836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 39917836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 39927836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 39937836SJohn.Forte@Sun.COM #ifdef WIN32 39947836SJohn.Forte@Sun.COM PassFunc = 39957836SJohn.Forte@Sun.COM (IMA_RemovePhbaStaticDiscoveryTargetFn) 39967836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 39977836SJohn.Forte@Sun.COM "IMA_RemovePhbaStaticDiscoveryTarget"); 39987836SJohn.Forte@Sun.COM #else 39997836SJohn.Forte@Sun.COM PassFunc = 40007836SJohn.Forte@Sun.COM (IMA_RemovePhbaStaticDiscoveryTargetFn) 40017836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 40027836SJohn.Forte@Sun.COM "IMA_RemovePhbaStaticDiscoveryTarget"); 40037836SJohn.Forte@Sun.COM #endif 40047836SJohn.Forte@Sun.COM 40057836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 40067836SJohn.Forte@Sun.COM status = PassFunc(phbaOid, targetOid); 40077836SJohn.Forte@Sun.COM } 40087836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 40097836SJohn.Forte@Sun.COM } 40107836SJohn.Forte@Sun.COM 40117836SJohn.Forte@Sun.COM break; 40127836SJohn.Forte@Sun.COM } 40137836SJohn.Forte@Sun.COM } 40147836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 40157836SJohn.Forte@Sun.COM return (status); 40167836SJohn.Forte@Sun.COM } 40177836SJohn.Forte@Sun.COM 40187836SJohn.Forte@Sun.COM 40197836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPnpOidList( 40207836SJohn.Forte@Sun.COM IMA_OID Oid, 40217836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 40227836SJohn.Forte@Sun.COM IMA_GetPnpOidListFn PassFunc; 40237836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 40247836SJohn.Forte@Sun.COM IMA_UINT i; 40257836SJohn.Forte@Sun.COM IMA_STATUS status; 40267836SJohn.Forte@Sun.COM 40277836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 40287836SJohn.Forte@Sun.COM InitLibrary(); 40297836SJohn.Forte@Sun.COM 40307836SJohn.Forte@Sun.COM if (ppList == NULL) 40317836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 40327836SJohn.Forte@Sun.COM 40337836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_PHBA && 40347836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_LNP) 40357836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 40367836SJohn.Forte@Sun.COM 40377836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 40387836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 40397836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 40407836SJohn.Forte@Sun.COM 40417836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 40427836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 40437836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 40447836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 40457836SJohn.Forte@Sun.COM #ifdef WIN32 40467836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPnpOidListFn) 40477836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 40487836SJohn.Forte@Sun.COM "IMA_GetPnpOidList"); 40497836SJohn.Forte@Sun.COM #else 40507836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPnpOidListFn) 40517836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 40527836SJohn.Forte@Sun.COM "IMA_GetPnpOidList"); 40537836SJohn.Forte@Sun.COM #endif 40547836SJohn.Forte@Sun.COM 40557836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 40567836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 40577836SJohn.Forte@Sun.COM 40587836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 40597836SJohn.Forte@Sun.COM if (IMA_SUCCESS(status)) { 40607836SJohn.Forte@Sun.COM IMA_UINT listSize; 40617836SJohn.Forte@Sun.COM listSize = 40627836SJohn.Forte@Sun.COM sizeof (IMA_OID_LIST); 40637836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*) 40647836SJohn.Forte@Sun.COM calloc(1, listSize + 40657836SJohn.Forte@Sun.COM (ppOidList->oidCount-1)* 40667836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 40677836SJohn.Forte@Sun.COM 40687836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 40697836SJohn.Forte@Sun.COM status = 40707836SJohn.Forte@Sun.COM EUOS_ERROR; 40717836SJohn.Forte@Sun.COM } 40727836SJohn.Forte@Sun.COM else 40737836SJohn.Forte@Sun.COM memcpy((*ppList), 40747836SJohn.Forte@Sun.COM ppOidList, 40757836SJohn.Forte@Sun.COM listSize + 40767836SJohn.Forte@Sun.COM (ppOidList-> 40777836SJohn.Forte@Sun.COM oidCount - 1)* 40787836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 40797836SJohn.Forte@Sun.COM #ifdef WIN32 40807836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 40817836SJohn.Forte@Sun.COM GetProcAddress( 40827836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 40837836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 40847836SJohn.Forte@Sun.COM #else 40857836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 40867836SJohn.Forte@Sun.COM dlsym( 40877836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 40887836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 40897836SJohn.Forte@Sun.COM #endif 40907836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 40917836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 40927836SJohn.Forte@Sun.COM } 40937836SJohn.Forte@Sun.COM } 40947836SJohn.Forte@Sun.COM } 40957836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 40967836SJohn.Forte@Sun.COM } 40977836SJohn.Forte@Sun.COM 40987836SJohn.Forte@Sun.COM break; 40997836SJohn.Forte@Sun.COM } 41007836SJohn.Forte@Sun.COM } 41017836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 41027836SJohn.Forte@Sun.COM return (status); 41037836SJohn.Forte@Sun.COM } 41047836SJohn.Forte@Sun.COM 41057836SJohn.Forte@Sun.COM 41067836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPhbaDownloadProperties( 41077836SJohn.Forte@Sun.COM IMA_OID phbaId, 41087836SJohn.Forte@Sun.COM IMA_PHBA_DOWNLOAD_PROPERTIES *pProps) { 41097836SJohn.Forte@Sun.COM IMA_GetPhbaDownloadPropertiesFn PassFunc; 41107836SJohn.Forte@Sun.COM IMA_UINT i; 41117836SJohn.Forte@Sun.COM IMA_STATUS status; 41127836SJohn.Forte@Sun.COM 41137836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 41147836SJohn.Forte@Sun.COM InitLibrary(); 41157836SJohn.Forte@Sun.COM 41167836SJohn.Forte@Sun.COM if (pProps == NULL) 41177836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 41187836SJohn.Forte@Sun.COM 41197836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA) 41207836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 41217836SJohn.Forte@Sun.COM 41227836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 41237836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 41247836SJohn.Forte@Sun.COM 41257836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 41267836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 41277836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 41287836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 41297836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 41307836SJohn.Forte@Sun.COM #ifdef WIN32 41317836SJohn.Forte@Sun.COM PassFunc = 41327836SJohn.Forte@Sun.COM (IMA_GetPhbaDownloadPropertiesFn) 41337836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 41347836SJohn.Forte@Sun.COM "IMA_GetPhbaDownloadProperties"); 41357836SJohn.Forte@Sun.COM #else 41367836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaDownloadPropertiesFn) 41377836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 41387836SJohn.Forte@Sun.COM "IMA_GetPhbaDownloadProperties"); 41397836SJohn.Forte@Sun.COM #endif 41407836SJohn.Forte@Sun.COM 41417836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 41427836SJohn.Forte@Sun.COM status = PassFunc(phbaId, pProps); 41437836SJohn.Forte@Sun.COM } 41447836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 41457836SJohn.Forte@Sun.COM } 41467836SJohn.Forte@Sun.COM 41477836SJohn.Forte@Sun.COM break; 41487836SJohn.Forte@Sun.COM } 41497836SJohn.Forte@Sun.COM } 41507836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 41517836SJohn.Forte@Sun.COM return (status); 41527836SJohn.Forte@Sun.COM } 41537836SJohn.Forte@Sun.COM 41547836SJohn.Forte@Sun.COM 41557836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_IsPhbaDownloadFile( 41567836SJohn.Forte@Sun.COM IMA_OID phbaId, 41577836SJohn.Forte@Sun.COM const IMA_WCHAR *pFileName, 41587836SJohn.Forte@Sun.COM IMA_PHBA_DOWNLOAD_IMAGE_PROPERTIES *pProps) { 41597836SJohn.Forte@Sun.COM IMA_IsPhbaDownloadFileFn PassFunc; 41607836SJohn.Forte@Sun.COM IMA_UINT i; 41617836SJohn.Forte@Sun.COM IMA_STATUS status; 41627836SJohn.Forte@Sun.COM 41637836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 41647836SJohn.Forte@Sun.COM InitLibrary(); 41657836SJohn.Forte@Sun.COM 41667836SJohn.Forte@Sun.COM if (pFileName == NULL || pProps == NULL) 41677836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 41687836SJohn.Forte@Sun.COM 41697836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA) 41707836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 41717836SJohn.Forte@Sun.COM 41727836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 41737836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 41747836SJohn.Forte@Sun.COM 41757836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 41767836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 41777836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 41787836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 41797836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 41807836SJohn.Forte@Sun.COM #ifdef WIN32 41817836SJohn.Forte@Sun.COM PassFunc = (IMA_IsPhbaDownloadFileFn) 41827836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 41837836SJohn.Forte@Sun.COM "IMA_IsPhbaDownloadFile"); 41847836SJohn.Forte@Sun.COM #else 41857836SJohn.Forte@Sun.COM PassFunc = (IMA_IsPhbaDownloadFileFn) 41867836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 41877836SJohn.Forte@Sun.COM "IMA_IsPhbaDownloadFile"); 41887836SJohn.Forte@Sun.COM #endif 41897836SJohn.Forte@Sun.COM 41907836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 41917836SJohn.Forte@Sun.COM status = PassFunc( 41927836SJohn.Forte@Sun.COM phbaId, pFileName, pProps); 41937836SJohn.Forte@Sun.COM } 41947836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 41957836SJohn.Forte@Sun.COM } 41967836SJohn.Forte@Sun.COM 41977836SJohn.Forte@Sun.COM break; 41987836SJohn.Forte@Sun.COM } 41997836SJohn.Forte@Sun.COM } 42007836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 42017836SJohn.Forte@Sun.COM return (status); 42027836SJohn.Forte@Sun.COM } 42037836SJohn.Forte@Sun.COM 42047836SJohn.Forte@Sun.COM 42057836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_PhbaDownload( 42067836SJohn.Forte@Sun.COM IMA_OID phbaId, 42077836SJohn.Forte@Sun.COM IMA_PHBA_DOWNLOAD_IMAGE_TYPE imageType, 42087836SJohn.Forte@Sun.COM const IMA_WCHAR *pFileName) { 42097836SJohn.Forte@Sun.COM IMA_PhbaDownloadFn PassFunc; 42107836SJohn.Forte@Sun.COM IMA_UINT i; 42117836SJohn.Forte@Sun.COM IMA_STATUS status; 42127836SJohn.Forte@Sun.COM 42137836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 42147836SJohn.Forte@Sun.COM InitLibrary(); 42157836SJohn.Forte@Sun.COM 42167836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA) 42177836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 42187836SJohn.Forte@Sun.COM 42197836SJohn.Forte@Sun.COM if (imageType != IMA_DOWNLOAD_IMAGE_TYPE_FIRMWARE && 42207836SJohn.Forte@Sun.COM imageType != IMA_DOWNLOAD_IMAGE_TYPE_OPTION_ROM && 42217836SJohn.Forte@Sun.COM imageType != IMA_DOWNLOAD_IMAGE_TYPE_ALL && 42227836SJohn.Forte@Sun.COM imageType != IMA_DOWNLOAD_IMAGE_TYPE_BOOTCODE) 42237836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 42247836SJohn.Forte@Sun.COM 42257836SJohn.Forte@Sun.COM if (pFileName == NULL) 42267836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 42277836SJohn.Forte@Sun.COM 42287836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 42297836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 42307836SJohn.Forte@Sun.COM 42317836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 42327836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 42337836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 42347836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 42357836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 42367836SJohn.Forte@Sun.COM #ifdef WIN32 42377836SJohn.Forte@Sun.COM PassFunc = (IMA_PhbaDownloadFn) 42387836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 42397836SJohn.Forte@Sun.COM "IMA_PhbaDownload"); 42407836SJohn.Forte@Sun.COM #else 42417836SJohn.Forte@Sun.COM PassFunc = (IMA_PhbaDownloadFn) 42427836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 42437836SJohn.Forte@Sun.COM "IMA_PhbaDownload"); 42447836SJohn.Forte@Sun.COM #endif 42457836SJohn.Forte@Sun.COM 42467836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 42477836SJohn.Forte@Sun.COM status = PassFunc( 42487836SJohn.Forte@Sun.COM phbaId, imageType, pFileName); 42497836SJohn.Forte@Sun.COM } 42507836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 42517836SJohn.Forte@Sun.COM } 42527836SJohn.Forte@Sun.COM 42537836SJohn.Forte@Sun.COM break; 42547836SJohn.Forte@Sun.COM } 42557836SJohn.Forte@Sun.COM } 42567836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 42577836SJohn.Forte@Sun.COM return (status); 42587836SJohn.Forte@Sun.COM } 42597836SJohn.Forte@Sun.COM 42607836SJohn.Forte@Sun.COM 42617836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetNetworkPortalProperties( 42627836SJohn.Forte@Sun.COM IMA_OID networkPortalId, 42637836SJohn.Forte@Sun.COM IMA_NETWORK_PORTAL_PROPERTIES *pProps) { 42647836SJohn.Forte@Sun.COM IMA_GetNetworkPortalPropertiesFn PassFunc; 42657836SJohn.Forte@Sun.COM IMA_UINT i; 42667836SJohn.Forte@Sun.COM IMA_STATUS status; 42677836SJohn.Forte@Sun.COM 42687836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 42697836SJohn.Forte@Sun.COM InitLibrary(); 42707836SJohn.Forte@Sun.COM 42717836SJohn.Forte@Sun.COM if (pProps == NULL) 42727836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 42737836SJohn.Forte@Sun.COM 42747836SJohn.Forte@Sun.COM if (networkPortalId.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL) 42757836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 42767836SJohn.Forte@Sun.COM 42777836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 42787836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 42797836SJohn.Forte@Sun.COM 42807836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 42817836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == networkPortalId.ownerId) { 42827836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 42837836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 42847836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 42857836SJohn.Forte@Sun.COM #ifdef WIN32 42867836SJohn.Forte@Sun.COM PassFunc = 42877836SJohn.Forte@Sun.COM (IMA_GetNetworkPortalPropertiesFn) 42887836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 42897836SJohn.Forte@Sun.COM "IMA_GetNetworkPortalProperties"); 42907836SJohn.Forte@Sun.COM #else 42917836SJohn.Forte@Sun.COM PassFunc = 42927836SJohn.Forte@Sun.COM (IMA_GetNetworkPortalPropertiesFn) 42937836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 42947836SJohn.Forte@Sun.COM "IMA_GetNetworkPortalProperties"); 42957836SJohn.Forte@Sun.COM #endif 42967836SJohn.Forte@Sun.COM 42977836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 42987836SJohn.Forte@Sun.COM status = PassFunc( 42997836SJohn.Forte@Sun.COM networkPortalId, pProps); 43007836SJohn.Forte@Sun.COM } 43017836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 43027836SJohn.Forte@Sun.COM } 43037836SJohn.Forte@Sun.COM 43047836SJohn.Forte@Sun.COM break; 43057836SJohn.Forte@Sun.COM } 43067836SJohn.Forte@Sun.COM } 43077836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 43087836SJohn.Forte@Sun.COM return (status); 43097836SJohn.Forte@Sun.COM } 43107836SJohn.Forte@Sun.COM 43117836SJohn.Forte@Sun.COM 43127836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetNetworkPortalIpAddress( 43137836SJohn.Forte@Sun.COM IMA_OID networkPortalId, 43147836SJohn.Forte@Sun.COM const IMA_IP_ADDRESS NewIpAddress) { 43157836SJohn.Forte@Sun.COM IMA_SetNetworkPortalIpAddressFn PassFunc; 43167836SJohn.Forte@Sun.COM IMA_UINT i; 43177836SJohn.Forte@Sun.COM IMA_STATUS status; 43187836SJohn.Forte@Sun.COM 43197836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 43207836SJohn.Forte@Sun.COM InitLibrary(); 43217836SJohn.Forte@Sun.COM 43227836SJohn.Forte@Sun.COM if (networkPortalId.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL) 43237836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 43247836SJohn.Forte@Sun.COM 43257836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 43267836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 43277836SJohn.Forte@Sun.COM 43287836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 43297836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == networkPortalId.ownerId) { 43307836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 43317836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 43327836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 43337836SJohn.Forte@Sun.COM #ifdef WIN32 43347836SJohn.Forte@Sun.COM PassFunc = 43357836SJohn.Forte@Sun.COM (IMA_SetNetworkPortalIpAddressFn) 43367836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 43377836SJohn.Forte@Sun.COM "IMA_SetNetworkPortalIpAddress"); 43387836SJohn.Forte@Sun.COM #else 43397836SJohn.Forte@Sun.COM PassFunc = (IMA_SetNetworkPortalIpAddressFn) 43407836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 43417836SJohn.Forte@Sun.COM "IMA_SetNetworkPortalIpAddress"); 43427836SJohn.Forte@Sun.COM #endif 43437836SJohn.Forte@Sun.COM 43447836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 43457836SJohn.Forte@Sun.COM status = PassFunc( 43467836SJohn.Forte@Sun.COM networkPortalId, NewIpAddress); 43477836SJohn.Forte@Sun.COM } 43487836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 43497836SJohn.Forte@Sun.COM } 43507836SJohn.Forte@Sun.COM 43517836SJohn.Forte@Sun.COM break; 43527836SJohn.Forte@Sun.COM } 43537836SJohn.Forte@Sun.COM } 43547836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 43557836SJohn.Forte@Sun.COM return (status); 43567836SJohn.Forte@Sun.COM } 43577836SJohn.Forte@Sun.COM 43587836SJohn.Forte@Sun.COM 43597836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLnpOidList( 43607836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 43617836SJohn.Forte@Sun.COM IMA_GetLnpOidListFn PassFunc; 43627836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 43637836SJohn.Forte@Sun.COM 43647836SJohn.Forte@Sun.COM IMA_UINT i; 43657836SJohn.Forte@Sun.COM IMA_UINT j; 43667836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 43677836SJohn.Forte@Sun.COM IMA_STATUS status; 43687836SJohn.Forte@Sun.COM 43697836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 43707836SJohn.Forte@Sun.COM InitLibrary(); 43717836SJohn.Forte@Sun.COM 43727836SJohn.Forte@Sun.COM if (ppList == NULL) 43737836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 43747836SJohn.Forte@Sun.COM 43757836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 43767836SJohn.Forte@Sun.COM // Get total id count first 43777836SJohn.Forte@Sun.COM totalIdCount = 0; 43787836SJohn.Forte@Sun.COM 43797836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 43807836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 43817836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 43827836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 43837836SJohn.Forte@Sun.COM #ifdef WIN32 43847836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLnpOidListFn) 43857836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 43867836SJohn.Forte@Sun.COM "IMA_GetLnpOidList"); 43877836SJohn.Forte@Sun.COM #else 43887836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLnpOidListFn) 43897836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 43907836SJohn.Forte@Sun.COM "IMA_GetLnpOidList"); 43917836SJohn.Forte@Sun.COM #endif 43927836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 43937836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 43947836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 43957836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 43967836SJohn.Forte@Sun.COM totalIdCount += ppOidList->oidCount; 43977836SJohn.Forte@Sun.COM #ifdef WIN32 43987836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 43997836SJohn.Forte@Sun.COM GetProcAddress( 44007836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 44017836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 44027836SJohn.Forte@Sun.COM #else 44037836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 44047836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 44057836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 44067836SJohn.Forte@Sun.COM #endif 44077836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 44087836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 44097836SJohn.Forte@Sun.COM } 44107836SJohn.Forte@Sun.COM } 44117836SJohn.Forte@Sun.COM } 44127836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 44137836SJohn.Forte@Sun.COM } 44147836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 44157836SJohn.Forte@Sun.COM break; 44167836SJohn.Forte@Sun.COM } 44177836SJohn.Forte@Sun.COM 44187836SJohn.Forte@Sun.COM } 44197836SJohn.Forte@Sun.COM 44207836SJohn.Forte@Sun.COM 44217836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, 44227836SJohn.Forte@Sun.COM sizeof (IMA_OID_LIST) + (totalIdCount - 1)* sizeof (IMA_OID)); 44237836SJohn.Forte@Sun.COM 44247836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 44257836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 44267836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 44277836SJohn.Forte@Sun.COM } 44287836SJohn.Forte@Sun.COM 44297836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 44307836SJohn.Forte@Sun.COM 44317836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 44327836SJohn.Forte@Sun.COM totalIdCount = 0; 44337836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 44347836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 44357836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 44367836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 44377836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 44387836SJohn.Forte@Sun.COM #ifdef WIN32 44397836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLnpOidListFn) 44407836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 44417836SJohn.Forte@Sun.COM "IMA_GetLnpOidList"); 44427836SJohn.Forte@Sun.COM #else 44437836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLnpOidListFn) 44447836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 44457836SJohn.Forte@Sun.COM "IMA_GetLnpOidList"); 44467836SJohn.Forte@Sun.COM #endif 44477836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 44487836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 44497836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 44507836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 44517836SJohn.Forte@Sun.COM for (j = 0; (j < ppOidList->oidCount) && 44527836SJohn.Forte@Sun.COM (totalIdCount < 44537836SJohn.Forte@Sun.COM (*ppList)->oidCount); 44547836SJohn.Forte@Sun.COM j++) { 44557836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 44567836SJohn.Forte@Sun.COM objectType = 44577836SJohn.Forte@Sun.COM ppOidList->oids[j]. 44587836SJohn.Forte@Sun.COM objectType; 44597836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 44607836SJohn.Forte@Sun.COM objectSequenceNumber = 44617836SJohn.Forte@Sun.COM ppOidList->oids[j]. 44627836SJohn.Forte@Sun.COM objectSequenceNumber; 44637836SJohn.Forte@Sun.COM 44647836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 44657836SJohn.Forte@Sun.COM ownerId = 44667836SJohn.Forte@Sun.COM ppOidList->oids[j].ownerId; 44677836SJohn.Forte@Sun.COM totalIdCount++; 44687836SJohn.Forte@Sun.COM } 44697836SJohn.Forte@Sun.COM #ifdef WIN32 44707836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 44717836SJohn.Forte@Sun.COM GetProcAddress( 44727836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 44737836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 44747836SJohn.Forte@Sun.COM #else 44757836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 44767836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 44777836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 44787836SJohn.Forte@Sun.COM #endif 44797836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 44807836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 44817836SJohn.Forte@Sun.COM } 44827836SJohn.Forte@Sun.COM } 44837836SJohn.Forte@Sun.COM } 44847836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 44857836SJohn.Forte@Sun.COM } 44867836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 44877836SJohn.Forte@Sun.COM free(*ppList); 44887836SJohn.Forte@Sun.COM break; 44897836SJohn.Forte@Sun.COM } 44907836SJohn.Forte@Sun.COM 44917836SJohn.Forte@Sun.COM } 44927836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 44937836SJohn.Forte@Sun.COM return (status); 44947836SJohn.Forte@Sun.COM } 44957836SJohn.Forte@Sun.COM 44967836SJohn.Forte@Sun.COM 44977836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLnpProperties( 44987836SJohn.Forte@Sun.COM IMA_OID lnpId, 44997836SJohn.Forte@Sun.COM IMA_LNP_PROPERTIES *pProps) { 45007836SJohn.Forte@Sun.COM IMA_GetLnpPropertiesFn PassFunc; 45017836SJohn.Forte@Sun.COM IMA_UINT i; 45027836SJohn.Forte@Sun.COM IMA_STATUS status; 45037836SJohn.Forte@Sun.COM 45047836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 45057836SJohn.Forte@Sun.COM InitLibrary(); 45067836SJohn.Forte@Sun.COM 45077836SJohn.Forte@Sun.COM if (pProps == NULL) 45087836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 45097836SJohn.Forte@Sun.COM 45107836SJohn.Forte@Sun.COM if (lnpId.objectType != IMA_OBJECT_TYPE_LNP) 45117836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 45127836SJohn.Forte@Sun.COM 45137836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 45147836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 45157836SJohn.Forte@Sun.COM 45167836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 45177836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lnpId.ownerId) { 45187836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 45197836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 45207836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 45217836SJohn.Forte@Sun.COM #ifdef WIN32 45227836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLnpPropertiesFn) 45237836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 45247836SJohn.Forte@Sun.COM "IMA_GetLnpProperties"); 45257836SJohn.Forte@Sun.COM #else 45267836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLnpPropertiesFn) 45277836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 45287836SJohn.Forte@Sun.COM "IMA_GetLnpProperties"); 45297836SJohn.Forte@Sun.COM #endif 45307836SJohn.Forte@Sun.COM 45317836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 45327836SJohn.Forte@Sun.COM status = PassFunc(lnpId, pProps); 45337836SJohn.Forte@Sun.COM } 45347836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 45357836SJohn.Forte@Sun.COM } 45367836SJohn.Forte@Sun.COM 45377836SJohn.Forte@Sun.COM break; 45387836SJohn.Forte@Sun.COM } 45397836SJohn.Forte@Sun.COM } 45407836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 45417836SJohn.Forte@Sun.COM return (status); 45427836SJohn.Forte@Sun.COM } 45437836SJohn.Forte@Sun.COM 45447836SJohn.Forte@Sun.COM 45457836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPnpProperties( 45467836SJohn.Forte@Sun.COM IMA_OID pnpId, 45477836SJohn.Forte@Sun.COM IMA_PNP_PROPERTIES *pProps) { 45487836SJohn.Forte@Sun.COM IMA_GetPnpPropertiesFn PassFunc; 45497836SJohn.Forte@Sun.COM IMA_UINT i; 45507836SJohn.Forte@Sun.COM IMA_STATUS status; 45517836SJohn.Forte@Sun.COM 45527836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 45537836SJohn.Forte@Sun.COM InitLibrary(); 45547836SJohn.Forte@Sun.COM 45557836SJohn.Forte@Sun.COM if (pProps == NULL) 45567836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 45577836SJohn.Forte@Sun.COM 45587836SJohn.Forte@Sun.COM if (pnpId.objectType != IMA_OBJECT_TYPE_PNP) 45597836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 45607836SJohn.Forte@Sun.COM 45617836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 45627836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 45637836SJohn.Forte@Sun.COM 45647836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 45657836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == pnpId.ownerId) { 45667836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 45677836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 45687836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 45697836SJohn.Forte@Sun.COM #ifdef WIN32 45707836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPnpPropertiesFn) 45717836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 45727836SJohn.Forte@Sun.COM "IMA_GetPnpProperties"); 45737836SJohn.Forte@Sun.COM #else 45747836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPnpPropertiesFn) 45757836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 45767836SJohn.Forte@Sun.COM "IMA_GetPnpProperties"); 45777836SJohn.Forte@Sun.COM #endif 45787836SJohn.Forte@Sun.COM 45797836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 45807836SJohn.Forte@Sun.COM status = PassFunc(pnpId, pProps); 45817836SJohn.Forte@Sun.COM } 45827836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 45837836SJohn.Forte@Sun.COM } 45847836SJohn.Forte@Sun.COM 45857836SJohn.Forte@Sun.COM break; 45867836SJohn.Forte@Sun.COM } 45877836SJohn.Forte@Sun.COM } 45887836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 45897836SJohn.Forte@Sun.COM return (status); 45907836SJohn.Forte@Sun.COM } 45917836SJohn.Forte@Sun.COM 45927836SJohn.Forte@Sun.COM 45937836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPnpStatistics( 45947836SJohn.Forte@Sun.COM IMA_OID pnpId, 45957836SJohn.Forte@Sun.COM IMA_PNP_STATISTICS *pStats) { 45967836SJohn.Forte@Sun.COM IMA_GetPnpStatisticsFn PassFunc; 45977836SJohn.Forte@Sun.COM IMA_UINT i; 45987836SJohn.Forte@Sun.COM IMA_STATUS status; 45997836SJohn.Forte@Sun.COM 46007836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 46017836SJohn.Forte@Sun.COM InitLibrary(); 46027836SJohn.Forte@Sun.COM 46037836SJohn.Forte@Sun.COM if (pStats == NULL) 46047836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 46057836SJohn.Forte@Sun.COM 46067836SJohn.Forte@Sun.COM if (pnpId.objectType != IMA_OBJECT_TYPE_PNP) 46077836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 46087836SJohn.Forte@Sun.COM 46097836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 46107836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 46117836SJohn.Forte@Sun.COM 46127836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 46137836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == pnpId.ownerId) { 46147836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 46157836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 46167836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 46177836SJohn.Forte@Sun.COM #ifdef WIN32 46187836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPnpStatisticsFn) 46197836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 46207836SJohn.Forte@Sun.COM "IMA_GetPnpStatistics"); 46217836SJohn.Forte@Sun.COM #else 46227836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPnpStatisticsFn) 46237836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 46247836SJohn.Forte@Sun.COM "IMA_GetPnpStatistics"); 46257836SJohn.Forte@Sun.COM #endif 46267836SJohn.Forte@Sun.COM 46277836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 46287836SJohn.Forte@Sun.COM status = PassFunc(pnpId, pStats); 46297836SJohn.Forte@Sun.COM } 46307836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 46317836SJohn.Forte@Sun.COM } 46327836SJohn.Forte@Sun.COM 46337836SJohn.Forte@Sun.COM break; 46347836SJohn.Forte@Sun.COM } 46357836SJohn.Forte@Sun.COM } 46367836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 46377836SJohn.Forte@Sun.COM return (status); 46387836SJohn.Forte@Sun.COM } 46397836SJohn.Forte@Sun.COM 46407836SJohn.Forte@Sun.COM 46417836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetTargetProperties( 46427836SJohn.Forte@Sun.COM IMA_OID targetId, 46437836SJohn.Forte@Sun.COM IMA_TARGET_PROPERTIES *pProps) { 46447836SJohn.Forte@Sun.COM IMA_GetTargetPropertiesFn PassFunc; 46457836SJohn.Forte@Sun.COM IMA_UINT i; 46467836SJohn.Forte@Sun.COM IMA_STATUS status; 46477836SJohn.Forte@Sun.COM 46487836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 46497836SJohn.Forte@Sun.COM InitLibrary(); 46507836SJohn.Forte@Sun.COM 46517836SJohn.Forte@Sun.COM if (pProps == NULL) 46527836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 46537836SJohn.Forte@Sun.COM 46547836SJohn.Forte@Sun.COM if (targetId.objectType != IMA_OBJECT_TYPE_TARGET) 46557836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 46567836SJohn.Forte@Sun.COM 46577836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 46587836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 46597836SJohn.Forte@Sun.COM 46607836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 46617836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == targetId.ownerId) { 46627836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 46637836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 46647836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 46657836SJohn.Forte@Sun.COM #ifdef WIN32 46667836SJohn.Forte@Sun.COM PassFunc = (IMA_GetTargetPropertiesFn) 46677836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 46687836SJohn.Forte@Sun.COM "IMA_GetTargetProperties"); 46697836SJohn.Forte@Sun.COM #else 46707836SJohn.Forte@Sun.COM PassFunc = (IMA_GetTargetPropertiesFn) 46717836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 46727836SJohn.Forte@Sun.COM "IMA_GetTargetProperties"); 46737836SJohn.Forte@Sun.COM #endif 46747836SJohn.Forte@Sun.COM 46757836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 46767836SJohn.Forte@Sun.COM status = PassFunc(targetId, pProps); 46777836SJohn.Forte@Sun.COM } 46787836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 46797836SJohn.Forte@Sun.COM } 46807836SJohn.Forte@Sun.COM 46817836SJohn.Forte@Sun.COM break; 46827836SJohn.Forte@Sun.COM } 46837836SJohn.Forte@Sun.COM } 46847836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 46857836SJohn.Forte@Sun.COM return (status); 46867836SJohn.Forte@Sun.COM } 46877836SJohn.Forte@Sun.COM 46887836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetSessionProperties( 46897836SJohn.Forte@Sun.COM IMA_OID sessionId, 46907836SJohn.Forte@Sun.COM IMA_SESSION_PROPERTIES *pProps) { 46917836SJohn.Forte@Sun.COM IMA_GetSessionPropertiesFn PassFunc; 46927836SJohn.Forte@Sun.COM IMA_UINT i; 46937836SJohn.Forte@Sun.COM IMA_STATUS status; 46947836SJohn.Forte@Sun.COM 46957836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 46967836SJohn.Forte@Sun.COM InitLibrary(); 46977836SJohn.Forte@Sun.COM 46987836SJohn.Forte@Sun.COM if (pProps == NULL) 46997836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 47007836SJohn.Forte@Sun.COM 47017836SJohn.Forte@Sun.COM if (sessionId.objectType != IMA_OBJECT_TYPE_SESSION) 47027836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 47037836SJohn.Forte@Sun.COM 47047836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 47057836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 47067836SJohn.Forte@Sun.COM 47077836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 47087836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == sessionId.ownerId) { 47097836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 47107836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 47117836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 47127836SJohn.Forte@Sun.COM #ifdef WIN32 47137836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSessionPropertiesFn) 47147836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 47157836SJohn.Forte@Sun.COM "IMA_GetSessionProperties"); 47167836SJohn.Forte@Sun.COM #else 47177836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSessionPropertiesFn) 47187836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 47197836SJohn.Forte@Sun.COM "IMA_GetSessionProperties"); 47207836SJohn.Forte@Sun.COM #endif 47217836SJohn.Forte@Sun.COM 47227836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 47237836SJohn.Forte@Sun.COM status = PassFunc(sessionId, pProps); 47247836SJohn.Forte@Sun.COM } 47257836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 47267836SJohn.Forte@Sun.COM } 47277836SJohn.Forte@Sun.COM 47287836SJohn.Forte@Sun.COM break; 47297836SJohn.Forte@Sun.COM } 47307836SJohn.Forte@Sun.COM } 47317836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 47327836SJohn.Forte@Sun.COM return (status); 47337836SJohn.Forte@Sun.COM } 47347836SJohn.Forte@Sun.COM 47357836SJohn.Forte@Sun.COM 47367836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetConnectionProperties( 47377836SJohn.Forte@Sun.COM IMA_OID connectionId, 47387836SJohn.Forte@Sun.COM IMA_CONNECTION_PROPERTIES *pProps) { 47397836SJohn.Forte@Sun.COM IMA_GetConnectionPropertiesFn PassFunc; 47407836SJohn.Forte@Sun.COM IMA_UINT i; 47417836SJohn.Forte@Sun.COM IMA_STATUS status; 47427836SJohn.Forte@Sun.COM 47437836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 47447836SJohn.Forte@Sun.COM InitLibrary(); 47457836SJohn.Forte@Sun.COM 47467836SJohn.Forte@Sun.COM if (pProps == NULL) 47477836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 47487836SJohn.Forte@Sun.COM 47497836SJohn.Forte@Sun.COM if (connectionId.objectType != IMA_OBJECT_TYPE_CONNECTION) 47507836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 47517836SJohn.Forte@Sun.COM 47527836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 47537836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 47547836SJohn.Forte@Sun.COM 47557836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 47567836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == connectionId.ownerId) { 47577836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 47587836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 47597836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 47607836SJohn.Forte@Sun.COM #ifdef WIN32 47617836SJohn.Forte@Sun.COM PassFunc = (IMA_GetConnectionPropertiesFn) 47627836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 47637836SJohn.Forte@Sun.COM "IMA_GetConnectionProperties"); 47647836SJohn.Forte@Sun.COM #else 47657836SJohn.Forte@Sun.COM PassFunc = (IMA_GetConnectionPropertiesFn) 47667836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 47677836SJohn.Forte@Sun.COM "IMA_GetConnectionProperties"); 47687836SJohn.Forte@Sun.COM #endif 47697836SJohn.Forte@Sun.COM 47707836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 47717836SJohn.Forte@Sun.COM status = PassFunc(connectionId, pProps); 47727836SJohn.Forte@Sun.COM } 47737836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 47747836SJohn.Forte@Sun.COM } 47757836SJohn.Forte@Sun.COM 47767836SJohn.Forte@Sun.COM break; 47777836SJohn.Forte@Sun.COM } 47787836SJohn.Forte@Sun.COM } 47797836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 47807836SJohn.Forte@Sun.COM return (status); 47817836SJohn.Forte@Sun.COM } 47827836SJohn.Forte@Sun.COM 47837836SJohn.Forte@Sun.COM 47847836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetTargetErrorStatistics( 47857836SJohn.Forte@Sun.COM IMA_OID targetId, 47867836SJohn.Forte@Sun.COM IMA_TARGET_ERROR_STATISTICS *pStats) { 47877836SJohn.Forte@Sun.COM IMA_GetTargetErrorStatisticsFn PassFunc; 47887836SJohn.Forte@Sun.COM IMA_UINT i; 47897836SJohn.Forte@Sun.COM IMA_STATUS status; 47907836SJohn.Forte@Sun.COM 47917836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 47927836SJohn.Forte@Sun.COM InitLibrary(); 47937836SJohn.Forte@Sun.COM 47947836SJohn.Forte@Sun.COM if (pStats == NULL) 47957836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 47967836SJohn.Forte@Sun.COM 47977836SJohn.Forte@Sun.COM if (targetId.objectType != IMA_OBJECT_TYPE_TARGET) 47987836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 47997836SJohn.Forte@Sun.COM 48007836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 48017836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 48027836SJohn.Forte@Sun.COM 48037836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 48047836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == targetId.ownerId) { 48057836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 48067836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 48077836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 48087836SJohn.Forte@Sun.COM #ifdef WIN32 48097836SJohn.Forte@Sun.COM PassFunc = (IMA_GetTargetErrorStatisticsFn) 48107836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 48117836SJohn.Forte@Sun.COM "IMA_GetTargetErrorStatistics"); 48127836SJohn.Forte@Sun.COM #else 48137836SJohn.Forte@Sun.COM PassFunc = (IMA_GetTargetErrorStatisticsFn) 48147836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 48157836SJohn.Forte@Sun.COM "IMA_GetTargetErrorStatistics"); 48167836SJohn.Forte@Sun.COM #endif 48177836SJohn.Forte@Sun.COM 48187836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 48197836SJohn.Forte@Sun.COM status = PassFunc(targetId, pStats); 48207836SJohn.Forte@Sun.COM } 48217836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 48227836SJohn.Forte@Sun.COM } 48237836SJohn.Forte@Sun.COM 48247836SJohn.Forte@Sun.COM break; 48257836SJohn.Forte@Sun.COM } 48267836SJohn.Forte@Sun.COM } 48277836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 48287836SJohn.Forte@Sun.COM return (status); 48297836SJohn.Forte@Sun.COM } 48307836SJohn.Forte@Sun.COM 48317836SJohn.Forte@Sun.COM 48327836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLuOidList( 48337836SJohn.Forte@Sun.COM IMA_OID Oid, 48347836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 48357836SJohn.Forte@Sun.COM IMA_GetLuOidListFn PassFunc; 48367836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 48377836SJohn.Forte@Sun.COM IMA_UINT i; 48387836SJohn.Forte@Sun.COM IMA_STATUS status; 48397836SJohn.Forte@Sun.COM 48407836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 48417836SJohn.Forte@Sun.COM InitLibrary(); 48427836SJohn.Forte@Sun.COM 48437836SJohn.Forte@Sun.COM if (ppList == NULL) 48447836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 48457836SJohn.Forte@Sun.COM 48467836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 48477836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 48487836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 48497836SJohn.Forte@Sun.COM 48507836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 48517836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 48527836SJohn.Forte@Sun.COM 48537836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 48547836SJohn.Forte@Sun.COM 48557836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 48567836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 48577836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 48587836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 48597836SJohn.Forte@Sun.COM #ifdef WIN32 48607836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLuOidListFn) 48617836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 48627836SJohn.Forte@Sun.COM "IMA_GetLuOidList"); 48637836SJohn.Forte@Sun.COM #else 48647836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLuOidListFn) 48657836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 48667836SJohn.Forte@Sun.COM "IMA_GetLuOidList"); 48677836SJohn.Forte@Sun.COM #endif 48687836SJohn.Forte@Sun.COM 48697836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 48707836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 48717836SJohn.Forte@Sun.COM 48727836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 48737836SJohn.Forte@Sun.COM if (IMA_SUCCESS(status)) { 48747836SJohn.Forte@Sun.COM IMA_UINT listSize; 48757836SJohn.Forte@Sun.COM listSize = 48767836SJohn.Forte@Sun.COM sizeof (IMA_OID_LIST); 48777836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*) 48787836SJohn.Forte@Sun.COM calloc(1, listSize + 48797836SJohn.Forte@Sun.COM (ppOidList->oidCount - 1)* 48807836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 48817836SJohn.Forte@Sun.COM 48827836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 48837836SJohn.Forte@Sun.COM status = EUOS_ERROR; 48847836SJohn.Forte@Sun.COM } 48857836SJohn.Forte@Sun.COM else 48867836SJohn.Forte@Sun.COM memcpy((*ppList), 48877836SJohn.Forte@Sun.COM ppOidList, 48887836SJohn.Forte@Sun.COM listSize + 48897836SJohn.Forte@Sun.COM (ppOidList-> 48907836SJohn.Forte@Sun.COM oidCount - 1)* 48917836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 48927836SJohn.Forte@Sun.COM #ifdef WIN32 48937836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 48947836SJohn.Forte@Sun.COM GetProcAddress( 48957836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 48967836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 48977836SJohn.Forte@Sun.COM #else 48987836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 48997836SJohn.Forte@Sun.COM dlsym( 49007836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 49017836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 49027836SJohn.Forte@Sun.COM #endif 49037836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 49047836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 49057836SJohn.Forte@Sun.COM } 49067836SJohn.Forte@Sun.COM } 49077836SJohn.Forte@Sun.COM } 49087836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 49097836SJohn.Forte@Sun.COM } 49107836SJohn.Forte@Sun.COM 49117836SJohn.Forte@Sun.COM break; 49127836SJohn.Forte@Sun.COM } 49137836SJohn.Forte@Sun.COM } 49147836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 49157836SJohn.Forte@Sun.COM return (status); 49167836SJohn.Forte@Sun.COM } 49177836SJohn.Forte@Sun.COM 49187836SJohn.Forte@Sun.COM 49197836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLuOid( 49207836SJohn.Forte@Sun.COM IMA_OID targetId, 49217836SJohn.Forte@Sun.COM IMA_UINT64 lun, 49227836SJohn.Forte@Sun.COM IMA_OID *pluId) { 49237836SJohn.Forte@Sun.COM IMA_GetLuOidFn PassFunc; 49247836SJohn.Forte@Sun.COM IMA_UINT i; 49257836SJohn.Forte@Sun.COM IMA_STATUS status; 49267836SJohn.Forte@Sun.COM 49277836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 49287836SJohn.Forte@Sun.COM InitLibrary(); 49297836SJohn.Forte@Sun.COM 49307836SJohn.Forte@Sun.COM if (pluId == NULL) 49317836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 49327836SJohn.Forte@Sun.COM 49337836SJohn.Forte@Sun.COM 49347836SJohn.Forte@Sun.COM if (targetId.objectType != IMA_OBJECT_TYPE_TARGET) 49357836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 49367836SJohn.Forte@Sun.COM 49377836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 49387836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 49397836SJohn.Forte@Sun.COM 49407836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 49417836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == targetId.ownerId) { 49427836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 49437836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 49447836SJohn.Forte@Sun.COM os_obtainmutex( 49457836SJohn.Forte@Sun.COM plugintable[i].pluginMutex); 49467836SJohn.Forte@Sun.COM #ifdef WIN32 49477836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLuOidFn) 49487836SJohn.Forte@Sun.COM GetProcAddress( 49497836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 49507836SJohn.Forte@Sun.COM "IMA_GetLuOid"); 49517836SJohn.Forte@Sun.COM #else 49527836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLuOidFn) 49537836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 49547836SJohn.Forte@Sun.COM "IMA_GetLuOid"); 49557836SJohn.Forte@Sun.COM #endif 49567836SJohn.Forte@Sun.COM 49577836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 49587836SJohn.Forte@Sun.COM status = 49597836SJohn.Forte@Sun.COM PassFunc(targetId, lun, pluId); 49607836SJohn.Forte@Sun.COM } 49617836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 49627836SJohn.Forte@Sun.COM } 49637836SJohn.Forte@Sun.COM 49647836SJohn.Forte@Sun.COM break; 49657836SJohn.Forte@Sun.COM } 49667836SJohn.Forte@Sun.COM } 49677836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 49687836SJohn.Forte@Sun.COM return (status); 49697836SJohn.Forte@Sun.COM } 49707836SJohn.Forte@Sun.COM 49717836SJohn.Forte@Sun.COM 49727836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLuProperties( 49737836SJohn.Forte@Sun.COM IMA_OID luId, 49747836SJohn.Forte@Sun.COM IMA_LU_PROPERTIES *pProps) { 49757836SJohn.Forte@Sun.COM IMA_GetLuPropertiesFn PassFunc; 49767836SJohn.Forte@Sun.COM IMA_UINT i; 49777836SJohn.Forte@Sun.COM IMA_STATUS status; 49787836SJohn.Forte@Sun.COM 49797836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 49807836SJohn.Forte@Sun.COM InitLibrary(); 49817836SJohn.Forte@Sun.COM 49827836SJohn.Forte@Sun.COM if (pProps == NULL) 49837836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 49847836SJohn.Forte@Sun.COM 49857836SJohn.Forte@Sun.COM if (luId.objectType != IMA_OBJECT_TYPE_LU) 49867836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 49877836SJohn.Forte@Sun.COM 49887836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 49897836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 49907836SJohn.Forte@Sun.COM 49917836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 49927836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == luId.ownerId) { 49937836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 49947836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 49957836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 49967836SJohn.Forte@Sun.COM #ifdef WIN32 49977836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLuPropertiesFn) 49987836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 49997836SJohn.Forte@Sun.COM "IMA_GetLuProperties"); 50007836SJohn.Forte@Sun.COM #else 50017836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLuPropertiesFn) 50027836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 50037836SJohn.Forte@Sun.COM "IMA_GetLuProperties"); 50047836SJohn.Forte@Sun.COM #endif 50057836SJohn.Forte@Sun.COM 50067836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 50077836SJohn.Forte@Sun.COM status = PassFunc(luId, pProps); 50087836SJohn.Forte@Sun.COM } 50097836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 50107836SJohn.Forte@Sun.COM } 50117836SJohn.Forte@Sun.COM 50127836SJohn.Forte@Sun.COM break; 50137836SJohn.Forte@Sun.COM } 50147836SJohn.Forte@Sun.COM } 50157836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 50167836SJohn.Forte@Sun.COM return (status); 50177836SJohn.Forte@Sun.COM } 50187836SJohn.Forte@Sun.COM 50197836SJohn.Forte@Sun.COM 50207836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetStatisticsProperties( 50217836SJohn.Forte@Sun.COM IMA_OID oid, 50227836SJohn.Forte@Sun.COM IMA_STATISTICS_PROPERTIES *pProps) { 50237836SJohn.Forte@Sun.COM IMA_GetStatisticsPropertiesFn PassFunc; 50247836SJohn.Forte@Sun.COM IMA_UINT i; 50257836SJohn.Forte@Sun.COM IMA_STATUS status; 50267836SJohn.Forte@Sun.COM 50277836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 50287836SJohn.Forte@Sun.COM InitLibrary(); 50297836SJohn.Forte@Sun.COM 50307836SJohn.Forte@Sun.COM if (pProps == NULL) 50317836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 50327836SJohn.Forte@Sun.COM 50337836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_TARGET && 50347836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_LU && 50357836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PNP) 50367836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 50377836SJohn.Forte@Sun.COM 50387836SJohn.Forte@Sun.COM 50397836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 50407836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 50417836SJohn.Forte@Sun.COM 50427836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 50437836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 50447836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 50457836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 50467836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 50477836SJohn.Forte@Sun.COM #ifdef WIN32 50487836SJohn.Forte@Sun.COM PassFunc = 50497836SJohn.Forte@Sun.COM (IMA_GetStatisticsPropertiesFn) 50507836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 50517836SJohn.Forte@Sun.COM "IMA_GetStatisticsProperties"); 50527836SJohn.Forte@Sun.COM #else 50537836SJohn.Forte@Sun.COM PassFunc = 50547836SJohn.Forte@Sun.COM (IMA_GetStatisticsPropertiesFn) 50557836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 50567836SJohn.Forte@Sun.COM "IMA_GetStatisticsProperties"); 50577836SJohn.Forte@Sun.COM #endif 50587836SJohn.Forte@Sun.COM 50597836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 50607836SJohn.Forte@Sun.COM status = PassFunc(oid, pProps); 50617836SJohn.Forte@Sun.COM } 50627836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 50637836SJohn.Forte@Sun.COM } 50647836SJohn.Forte@Sun.COM 50657836SJohn.Forte@Sun.COM break; 50667836SJohn.Forte@Sun.COM } 50677836SJohn.Forte@Sun.COM } 50687836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 50697836SJohn.Forte@Sun.COM return (status); 50707836SJohn.Forte@Sun.COM } 50717836SJohn.Forte@Sun.COM 50727836SJohn.Forte@Sun.COM 50737836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDeviceStatistics( 50747836SJohn.Forte@Sun.COM IMA_OID oid, 50757836SJohn.Forte@Sun.COM IMA_DEVICE_STATISTICS *pStats) { 50767836SJohn.Forte@Sun.COM IMA_GetDeviceStatisticsFn PassFunc; 50777836SJohn.Forte@Sun.COM IMA_UINT i; 50787836SJohn.Forte@Sun.COM IMA_STATUS status; 50797836SJohn.Forte@Sun.COM 50807836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 50817836SJohn.Forte@Sun.COM InitLibrary(); 50827836SJohn.Forte@Sun.COM 50837836SJohn.Forte@Sun.COM if (pStats == NULL) 50847836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 50857836SJohn.Forte@Sun.COM 50867836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_LU && 50877836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_TARGET) 50887836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 50897836SJohn.Forte@Sun.COM 50907836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 50917836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 50927836SJohn.Forte@Sun.COM 50937836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 50947836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 50957836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 50967836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 50977836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 50987836SJohn.Forte@Sun.COM #ifdef WIN32 50997836SJohn.Forte@Sun.COM PassFunc = 51007836SJohn.Forte@Sun.COM (IMA_GetDeviceStatisticsFn) 51017836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 51027836SJohn.Forte@Sun.COM "IMA_GetDeviceStatistics"); 51037836SJohn.Forte@Sun.COM #else 51047836SJohn.Forte@Sun.COM PassFunc = 51057836SJohn.Forte@Sun.COM (IMA_GetDeviceStatisticsFn) 51067836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 51077836SJohn.Forte@Sun.COM "IMA_GetDeviceStatistics"); 51087836SJohn.Forte@Sun.COM #endif 51097836SJohn.Forte@Sun.COM 51107836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 51117836SJohn.Forte@Sun.COM status = PassFunc(oid, pStats); 51127836SJohn.Forte@Sun.COM } 51137836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 51147836SJohn.Forte@Sun.COM } 51157836SJohn.Forte@Sun.COM 51167836SJohn.Forte@Sun.COM break; 51177836SJohn.Forte@Sun.COM } 51187836SJohn.Forte@Sun.COM } 51197836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 51207836SJohn.Forte@Sun.COM return (status); 51217836SJohn.Forte@Sun.COM } 51227836SJohn.Forte@Sun.COM 51237836SJohn.Forte@Sun.COM 51247836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_LuInquiry( 51257836SJohn.Forte@Sun.COM IMA_OID deviceId, 51267836SJohn.Forte@Sun.COM IMA_BOOL evpd, 51277836SJohn.Forte@Sun.COM IMA_BOOL cmddt, 51287836SJohn.Forte@Sun.COM IMA_BYTE pageCode, 51297836SJohn.Forte@Sun.COM 51307836SJohn.Forte@Sun.COM IMA_BYTE *pOutputBuffer, 51317836SJohn.Forte@Sun.COM IMA_UINT *pOutputBufferLength, 51327836SJohn.Forte@Sun.COM 51337836SJohn.Forte@Sun.COM IMA_BYTE *pSenseBuffer, 51347836SJohn.Forte@Sun.COM IMA_UINT *pSenseBufferLength) { 51357836SJohn.Forte@Sun.COM IMA_LuInquiryFn PassFunc; 51367836SJohn.Forte@Sun.COM IMA_UINT i; 51377836SJohn.Forte@Sun.COM IMA_STATUS status; 51387836SJohn.Forte@Sun.COM 51397836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 51407836SJohn.Forte@Sun.COM InitLibrary(); 51417836SJohn.Forte@Sun.COM 51427836SJohn.Forte@Sun.COM if (pOutputBuffer == NULL || pOutputBufferLength == NULL || 51437836SJohn.Forte@Sun.COM *pOutputBufferLength == 0 || 51447836SJohn.Forte@Sun.COM pSenseBuffer == NULL || pSenseBufferLength == NULL || 51457836SJohn.Forte@Sun.COM *pSenseBufferLength == 0) 51467836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 51477836SJohn.Forte@Sun.COM 51487836SJohn.Forte@Sun.COM if ((evpd != IMA_TRUE && evpd != IMA_FALSE) || 51497836SJohn.Forte@Sun.COM (cmddt != IMA_TRUE && cmddt != IMA_FALSE)) 51507836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 51517836SJohn.Forte@Sun.COM 51527836SJohn.Forte@Sun.COM if (deviceId.objectType != IMA_OBJECT_TYPE_TARGET && 51537836SJohn.Forte@Sun.COM deviceId.objectType != IMA_OBJECT_TYPE_LU) 51547836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 51557836SJohn.Forte@Sun.COM 51567836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 51577836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 51587836SJohn.Forte@Sun.COM 51597836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 51607836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == deviceId.ownerId) { 51617836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 51627836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 51637836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 51647836SJohn.Forte@Sun.COM #ifdef WIN32 51657836SJohn.Forte@Sun.COM PassFunc = (IMA_LuInquiryFn) 51667836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 51677836SJohn.Forte@Sun.COM "IMA_LuInquiry"); 51687836SJohn.Forte@Sun.COM #else 51697836SJohn.Forte@Sun.COM PassFunc = (IMA_LuInquiryFn) 51707836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 51717836SJohn.Forte@Sun.COM "IMA_LuInquiry"); 51727836SJohn.Forte@Sun.COM #endif 51737836SJohn.Forte@Sun.COM 51747836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 51757836SJohn.Forte@Sun.COM status = 51767836SJohn.Forte@Sun.COM PassFunc(deviceId, evpd, 51777836SJohn.Forte@Sun.COM cmddt, pageCode, 51787836SJohn.Forte@Sun.COM pOutputBuffer, pOutputBufferLength, 51797836SJohn.Forte@Sun.COM pSenseBuffer, pSenseBufferLength); 51807836SJohn.Forte@Sun.COM } 51817836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 51827836SJohn.Forte@Sun.COM } 51837836SJohn.Forte@Sun.COM 51847836SJohn.Forte@Sun.COM break; 51857836SJohn.Forte@Sun.COM } 51867836SJohn.Forte@Sun.COM } 51877836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 51887836SJohn.Forte@Sun.COM return (status); 51897836SJohn.Forte@Sun.COM } 51907836SJohn.Forte@Sun.COM 51917836SJohn.Forte@Sun.COM 51927836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_LuReadCapacity( 51937836SJohn.Forte@Sun.COM IMA_OID deviceId, 51947836SJohn.Forte@Sun.COM IMA_UINT cdbLength, 51957836SJohn.Forte@Sun.COM IMA_BYTE *pOutputBuffer, 51967836SJohn.Forte@Sun.COM IMA_UINT *pOutputBufferLength, 51977836SJohn.Forte@Sun.COM 51987836SJohn.Forte@Sun.COM IMA_BYTE *pSenseBuffer, 51997836SJohn.Forte@Sun.COM IMA_UINT *pSenseBufferLength) { 52007836SJohn.Forte@Sun.COM IMA_LuReadCapacityFn PassFunc; 52017836SJohn.Forte@Sun.COM IMA_UINT i; 52027836SJohn.Forte@Sun.COM IMA_STATUS status; 52037836SJohn.Forte@Sun.COM 52047836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 52057836SJohn.Forte@Sun.COM InitLibrary(); 52067836SJohn.Forte@Sun.COM 52077836SJohn.Forte@Sun.COM if (cdbLength != 10 && cdbLength != 16) 52087836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 52097836SJohn.Forte@Sun.COM 52107836SJohn.Forte@Sun.COM if ((pOutputBuffer == NULL || pOutputBufferLength == NULL || 52117836SJohn.Forte@Sun.COM *pOutputBufferLength == 0) || 52127836SJohn.Forte@Sun.COM (pSenseBuffer == NULL && pSenseBufferLength != NULL && 52137836SJohn.Forte@Sun.COM *pSenseBufferLength != 0)) 52147836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 52157836SJohn.Forte@Sun.COM 52167836SJohn.Forte@Sun.COM if (deviceId.objectType != IMA_OBJECT_TYPE_TARGET && 52177836SJohn.Forte@Sun.COM deviceId.objectType != IMA_OBJECT_TYPE_LU) 52187836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 52197836SJohn.Forte@Sun.COM 52207836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 52217836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 52227836SJohn.Forte@Sun.COM 52237836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 52247836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == deviceId.ownerId) { 52257836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 52267836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 52277836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 52287836SJohn.Forte@Sun.COM #ifdef WIN32 52297836SJohn.Forte@Sun.COM PassFunc = (IMA_LuReadCapacityFn) 52307836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 52317836SJohn.Forte@Sun.COM "IMA_LuReadCapacity"); 52327836SJohn.Forte@Sun.COM #else 52337836SJohn.Forte@Sun.COM PassFunc = (IMA_LuReadCapacityFn) 52347836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 52357836SJohn.Forte@Sun.COM "IMA_LuReadCapacity"); 52367836SJohn.Forte@Sun.COM #endif 52377836SJohn.Forte@Sun.COM 52387836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 52397836SJohn.Forte@Sun.COM status = PassFunc(deviceId, cdbLength, 52407836SJohn.Forte@Sun.COM pOutputBuffer, pOutputBufferLength, 52417836SJohn.Forte@Sun.COM pSenseBuffer, pSenseBufferLength); 52427836SJohn.Forte@Sun.COM } 52437836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 52447836SJohn.Forte@Sun.COM } 52457836SJohn.Forte@Sun.COM 52467836SJohn.Forte@Sun.COM break; 52477836SJohn.Forte@Sun.COM } 52487836SJohn.Forte@Sun.COM } 52497836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 52507836SJohn.Forte@Sun.COM return (status); 52517836SJohn.Forte@Sun.COM } 52527836SJohn.Forte@Sun.COM 52537836SJohn.Forte@Sun.COM 52547836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_LuReportLuns( 52557836SJohn.Forte@Sun.COM IMA_OID deviceId, 52567836SJohn.Forte@Sun.COM IMA_BOOL sendToWellKnownLun, 52577836SJohn.Forte@Sun.COM IMA_BYTE selectReport, 52587836SJohn.Forte@Sun.COM 52597836SJohn.Forte@Sun.COM IMA_BYTE *pOutputBuffer, 52607836SJohn.Forte@Sun.COM IMA_UINT *pOutputBufferLength, 52617836SJohn.Forte@Sun.COM 52627836SJohn.Forte@Sun.COM IMA_BYTE *pSenseBuffer, 52637836SJohn.Forte@Sun.COM IMA_UINT *pSenseBufferLength) { 52647836SJohn.Forte@Sun.COM IMA_LuReportLunsFn PassFunc; 52657836SJohn.Forte@Sun.COM IMA_UINT i; 52667836SJohn.Forte@Sun.COM IMA_STATUS status; 52677836SJohn.Forte@Sun.COM 52687836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 52697836SJohn.Forte@Sun.COM InitLibrary(); 52707836SJohn.Forte@Sun.COM 52717836SJohn.Forte@Sun.COM if ((pOutputBuffer == NULL || pOutputBufferLength == NULL || 52727836SJohn.Forte@Sun.COM *pOutputBufferLength == 0) || 52737836SJohn.Forte@Sun.COM (pSenseBuffer == NULL && pSenseBufferLength != NULL && 52747836SJohn.Forte@Sun.COM *pSenseBufferLength != 0)) 52757836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 52767836SJohn.Forte@Sun.COM 52777836SJohn.Forte@Sun.COM if (sendToWellKnownLun != IMA_TRUE && sendToWellKnownLun != IMA_FALSE) 52787836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 52797836SJohn.Forte@Sun.COM 52807836SJohn.Forte@Sun.COM if (deviceId.objectType != IMA_OBJECT_TYPE_TARGET && 52817836SJohn.Forte@Sun.COM deviceId.objectType != IMA_OBJECT_TYPE_LU) 52827836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 52837836SJohn.Forte@Sun.COM 52847836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 52857836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 52867836SJohn.Forte@Sun.COM 52877836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 52887836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == deviceId.ownerId) { 52897836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 52907836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 52917836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 52927836SJohn.Forte@Sun.COM #ifdef WIN32 52937836SJohn.Forte@Sun.COM PassFunc = (IMA_LuReportLunsFn) 52947836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 52957836SJohn.Forte@Sun.COM "IMA_LuReportLuns"); 52967836SJohn.Forte@Sun.COM #else 52977836SJohn.Forte@Sun.COM PassFunc = (IMA_LuReportLunsFn) 52987836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 52997836SJohn.Forte@Sun.COM "IMA_LuReportLuns"); 53007836SJohn.Forte@Sun.COM #endif 53017836SJohn.Forte@Sun.COM 53027836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 53037836SJohn.Forte@Sun.COM status = PassFunc(deviceId, 53047836SJohn.Forte@Sun.COM sendToWellKnownLun, selectReport, 53057836SJohn.Forte@Sun.COM pOutputBuffer, pOutputBufferLength, 53067836SJohn.Forte@Sun.COM pSenseBuffer, pSenseBufferLength); 53077836SJohn.Forte@Sun.COM } 53087836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 53097836SJohn.Forte@Sun.COM } 53107836SJohn.Forte@Sun.COM 53117836SJohn.Forte@Sun.COM break; 53127836SJohn.Forte@Sun.COM } 53137836SJohn.Forte@Sun.COM } 53147836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 53157836SJohn.Forte@Sun.COM return (status); 53167836SJohn.Forte@Sun.COM } 53177836SJohn.Forte@Sun.COM 53187836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_ExposeLu( 53197836SJohn.Forte@Sun.COM IMA_OID luId) { 53207836SJohn.Forte@Sun.COM IMA_ExposeLuFn PassFunc; 53217836SJohn.Forte@Sun.COM IMA_UINT i; 53227836SJohn.Forte@Sun.COM IMA_STATUS status; 53237836SJohn.Forte@Sun.COM 53247836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 53257836SJohn.Forte@Sun.COM InitLibrary(); 53267836SJohn.Forte@Sun.COM 53277836SJohn.Forte@Sun.COM if (luId.objectType != IMA_OBJECT_TYPE_LU) 53287836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_OBJECT_TYPE); 53297836SJohn.Forte@Sun.COM 53307836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 53317836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 53327836SJohn.Forte@Sun.COM 53337836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 53347836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == luId.ownerId) { 53357836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 53367836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 53377836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 53387836SJohn.Forte@Sun.COM #ifdef WIN32 53397836SJohn.Forte@Sun.COM PassFunc = (IMA_ExposeLuFn) 53407836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 53417836SJohn.Forte@Sun.COM "IMA_ExposeLu"); 53427836SJohn.Forte@Sun.COM 53437836SJohn.Forte@Sun.COM #else 53447836SJohn.Forte@Sun.COM PassFunc = (IMA_ExposeLuFn) 53457836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 53467836SJohn.Forte@Sun.COM "IMA_ExposeLu"); 53477836SJohn.Forte@Sun.COM #endif 53487836SJohn.Forte@Sun.COM 53497836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 53507836SJohn.Forte@Sun.COM status = PassFunc(luId); 53517836SJohn.Forte@Sun.COM } 53527836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 53537836SJohn.Forte@Sun.COM } 53547836SJohn.Forte@Sun.COM 53557836SJohn.Forte@Sun.COM break; 53567836SJohn.Forte@Sun.COM } 53577836SJohn.Forte@Sun.COM } 53587836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 53597836SJohn.Forte@Sun.COM return (status); 53607836SJohn.Forte@Sun.COM } 53617836SJohn.Forte@Sun.COM 53627836SJohn.Forte@Sun.COM 53637836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_UnexposeLu( 53647836SJohn.Forte@Sun.COM IMA_OID luId) { 53657836SJohn.Forte@Sun.COM IMA_UnexposeLuFn PassFunc; 53667836SJohn.Forte@Sun.COM IMA_UINT i; 53677836SJohn.Forte@Sun.COM IMA_STATUS status; 53687836SJohn.Forte@Sun.COM 53697836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 53707836SJohn.Forte@Sun.COM InitLibrary(); 53717836SJohn.Forte@Sun.COM 53727836SJohn.Forte@Sun.COM if (luId.objectType != IMA_OBJECT_TYPE_LU) 53737836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 53747836SJohn.Forte@Sun.COM 53757836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 53767836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 53777836SJohn.Forte@Sun.COM 53787836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 53797836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == luId.ownerId) { 53807836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 53817836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 53827836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 53837836SJohn.Forte@Sun.COM #ifdef WIN32 53847836SJohn.Forte@Sun.COM PassFunc = (IMA_UnexposeLuFn) 53857836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 53867836SJohn.Forte@Sun.COM "IMA_UnexposeLu"); 53877836SJohn.Forte@Sun.COM #else 53887836SJohn.Forte@Sun.COM PassFunc = (IMA_UnexposeLuFn) 53897836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 53907836SJohn.Forte@Sun.COM "IMA_UnexposeLu"); 53917836SJohn.Forte@Sun.COM #endif 53927836SJohn.Forte@Sun.COM 53937836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 53947836SJohn.Forte@Sun.COM status = PassFunc(luId); 53957836SJohn.Forte@Sun.COM } 53967836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 53977836SJohn.Forte@Sun.COM } 53987836SJohn.Forte@Sun.COM 53997836SJohn.Forte@Sun.COM break; 54007836SJohn.Forte@Sun.COM } 54017836SJohn.Forte@Sun.COM } 54027836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 54037836SJohn.Forte@Sun.COM return (status); 54047836SJohn.Forte@Sun.COM } 54057836SJohn.Forte@Sun.COM 54067836SJohn.Forte@Sun.COM 54077836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPhbaStatus( 54087836SJohn.Forte@Sun.COM IMA_OID hbaId, 54097836SJohn.Forte@Sun.COM IMA_PHBA_STATUS *pStatus) { 54107836SJohn.Forte@Sun.COM IMA_GetPhbaStatusFn PassFunc; 54117836SJohn.Forte@Sun.COM IMA_UINT i; 54127836SJohn.Forte@Sun.COM IMA_STATUS status; 54137836SJohn.Forte@Sun.COM 54147836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 54157836SJohn.Forte@Sun.COM InitLibrary(); 54167836SJohn.Forte@Sun.COM 54177836SJohn.Forte@Sun.COM if (pStatus == NULL) 54187836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 54197836SJohn.Forte@Sun.COM 54207836SJohn.Forte@Sun.COM if (hbaId.objectType != IMA_OBJECT_TYPE_PHBA) 54217836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 54227836SJohn.Forte@Sun.COM 54237836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 54247836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 54257836SJohn.Forte@Sun.COM 54267836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 54277836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == hbaId.ownerId) { 54287836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 54297836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 54307836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 54317836SJohn.Forte@Sun.COM #ifdef WIN32 54327836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaStatusFn) 54337836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 54347836SJohn.Forte@Sun.COM "IMA_GetPhbaStatus"); 54357836SJohn.Forte@Sun.COM #else 54367836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaStatusFn) 54377836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 54387836SJohn.Forte@Sun.COM "IMA_GetPhbaStatus"); 54397836SJohn.Forte@Sun.COM #endif 54407836SJohn.Forte@Sun.COM 54417836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 54427836SJohn.Forte@Sun.COM status = PassFunc(hbaId, pStatus); 54437836SJohn.Forte@Sun.COM } 54447836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 54457836SJohn.Forte@Sun.COM } 54467836SJohn.Forte@Sun.COM 54477836SJohn.Forte@Sun.COM break; 54487836SJohn.Forte@Sun.COM } 54497836SJohn.Forte@Sun.COM } 54507836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 54517836SJohn.Forte@Sun.COM return (status); 54527836SJohn.Forte@Sun.COM } 54537836SJohn.Forte@Sun.COM 54547836SJohn.Forte@Sun.COM 54557836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_RegisterForObjectVisibilityChanges( 54567836SJohn.Forte@Sun.COM IMA_OBJECT_VISIBILITY_FN pClientFn) { 54577836SJohn.Forte@Sun.COM IMA_RegisterForObjectVisibilityChangesFn PassFunc; 54587836SJohn.Forte@Sun.COM IMA_UINT i; 54597836SJohn.Forte@Sun.COM IMA_UINT j; 54607836SJohn.Forte@Sun.COM IMA_STATUS status; 54617836SJohn.Forte@Sun.COM 54627836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 54637836SJohn.Forte@Sun.COM InitLibrary(); 54647836SJohn.Forte@Sun.COM 54657836SJohn.Forte@Sun.COM if (pClientFn == NULL) 54667836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 54677836SJohn.Forte@Sun.COM 54687836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 54697836SJohn.Forte@Sun.COM 54707836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 54717836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 54727836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 54737836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 54747836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 54757836SJohn.Forte@Sun.COM if (plugintable[i].number_of_vbcallbacks >= 54767836SJohn.Forte@Sun.COM IMA_MAX_CALLBACK_PER_PLUGIN) { 54777836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 54787836SJohn.Forte@Sun.COM continue; 54797836SJohn.Forte@Sun.COM } 54807836SJohn.Forte@Sun.COM 54817836SJohn.Forte@Sun.COM /* check if registered already */ 54827836SJohn.Forte@Sun.COM for (j = 0; 54837836SJohn.Forte@Sun.COM j < plugintable[i].number_of_vbcallbacks; j++) { 54847836SJohn.Forte@Sun.COM if (plugintable[i].vbcallback[j] == pClientFn) { 54857836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 54867836SJohn.Forte@Sun.COM break; 54877836SJohn.Forte@Sun.COM } 54887836SJohn.Forte@Sun.COM } 54897836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 54907836SJohn.Forte@Sun.COM 54917836SJohn.Forte@Sun.COM #ifdef WIN32 54927836SJohn.Forte@Sun.COM PassFunc = 54937836SJohn.Forte@Sun.COM (IMA_RegisterForObjectVisibilityChangesFn) 54947836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 54957836SJohn.Forte@Sun.COM "IMA_RegisterForObjectVisibilityChanges"); 54967836SJohn.Forte@Sun.COM #else 54977836SJohn.Forte@Sun.COM PassFunc = 54987836SJohn.Forte@Sun.COM (IMA_RegisterForObjectVisibilityChangesFn) 54997836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 55007836SJohn.Forte@Sun.COM "IMA_RegisterForObjectVisibilityChanges"); 55017836SJohn.Forte@Sun.COM #endif 55027836SJohn.Forte@Sun.COM 55037836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 55047836SJohn.Forte@Sun.COM status = PassFunc(VisibilityCallback); 55057836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 55067836SJohn.Forte@Sun.COM j = plugintable[i]. 55077836SJohn.Forte@Sun.COM number_of_vbcallbacks; 55087836SJohn.Forte@Sun.COM plugintable[i].vbcallback[j] = 55097836SJohn.Forte@Sun.COM pClientFn; 55107836SJohn.Forte@Sun.COM plugintable[i]. 55117836SJohn.Forte@Sun.COM number_of_vbcallbacks++; 55127836SJohn.Forte@Sun.COM } 55137836SJohn.Forte@Sun.COM 55147836SJohn.Forte@Sun.COM } 55157836SJohn.Forte@Sun.COM } 55167836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 55177836SJohn.Forte@Sun.COM } 55187836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) 55197836SJohn.Forte@Sun.COM break; 55207836SJohn.Forte@Sun.COM 55217836SJohn.Forte@Sun.COM } 55227836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 55237836SJohn.Forte@Sun.COM return (status); 55247836SJohn.Forte@Sun.COM 55257836SJohn.Forte@Sun.COM } 55267836SJohn.Forte@Sun.COM 55277836SJohn.Forte@Sun.COM 55287836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_DeregisterForObjectVisibilityChanges( 55297836SJohn.Forte@Sun.COM IMA_OBJECT_VISIBILITY_FN pClientFn) { 55307836SJohn.Forte@Sun.COM IMA_DeregisterForObjectVisibilityChangesFn PassFunc; 55317836SJohn.Forte@Sun.COM IMA_UINT i; 55327836SJohn.Forte@Sun.COM IMA_UINT j; 55337836SJohn.Forte@Sun.COM IMA_STATUS status; 55347836SJohn.Forte@Sun.COM 55357836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 55367836SJohn.Forte@Sun.COM InitLibrary(); 55377836SJohn.Forte@Sun.COM 55387836SJohn.Forte@Sun.COM if (pClientFn == NULL) 55397836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 55407836SJohn.Forte@Sun.COM 55417836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 55427836SJohn.Forte@Sun.COM 55437836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 55447836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 55457836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 55467836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 55477836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 55487836SJohn.Forte@Sun.COM /* check if deregistered already */ 55497836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 55507836SJohn.Forte@Sun.COM for (j = 0; 55517836SJohn.Forte@Sun.COM j < plugintable[i].number_of_vbcallbacks; j++) { 55527836SJohn.Forte@Sun.COM if (plugintable[i].vbcallback[j] == pClientFn) { 55537836SJohn.Forte@Sun.COM /* 55547836SJohn.Forte@Sun.COM * use IMA_ERROR_UNKNOWN_ERROR 55557836SJohn.Forte@Sun.COM * as a flag 55567836SJohn.Forte@Sun.COM */ 55577836SJohn.Forte@Sun.COM status = IMA_ERROR_UNKNOWN_ERROR; 55587836SJohn.Forte@Sun.COM break; 55597836SJohn.Forte@Sun.COM } 55607836SJohn.Forte@Sun.COM } 55617836SJohn.Forte@Sun.COM 55627836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 55637836SJohn.Forte@Sun.COM 55647836SJohn.Forte@Sun.COM #ifdef WIN32 55657836SJohn.Forte@Sun.COM PassFunc = 55667836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectVisibilityChangesFn) 55677836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 55687836SJohn.Forte@Sun.COM "IMA_DeregisterForObjectVisibilityChanges"); 55697836SJohn.Forte@Sun.COM #else 55707836SJohn.Forte@Sun.COM PassFunc = 55717836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectVisibilityChangesFn) 55727836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 55737836SJohn.Forte@Sun.COM "IMA_DeregisterForObjectVisibilityChanges"); 55747836SJohn.Forte@Sun.COM #endif 55757836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 55767836SJohn.Forte@Sun.COM status = PassFunc(VisibilityCallback); 55777836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 55787836SJohn.Forte@Sun.COM /* 55797836SJohn.Forte@Sun.COM * where plugintable[i]. 55807836SJohn.Forte@Sun.COM * vbcallback[j] == pClientFn 55817836SJohn.Forte@Sun.COM */ 55827836SJohn.Forte@Sun.COM for (; j < 55837836SJohn.Forte@Sun.COM plugintable[i]. 55847836SJohn.Forte@Sun.COM number_of_vbcallbacks; 55857836SJohn.Forte@Sun.COM j++) { 55867836SJohn.Forte@Sun.COM plugintable[i]. 55877836SJohn.Forte@Sun.COM vbcallback[j] = 55887836SJohn.Forte@Sun.COM plugintable[i]. 55897836SJohn.Forte@Sun.COM vbcallback[j+1]; 55907836SJohn.Forte@Sun.COM 55917836SJohn.Forte@Sun.COM } 55927836SJohn.Forte@Sun.COM plugintable[i]. 55937836SJohn.Forte@Sun.COM number_of_vbcallbacks--; 55947836SJohn.Forte@Sun.COM } 55957836SJohn.Forte@Sun.COM } 55967836SJohn.Forte@Sun.COM } 55977836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 55987836SJohn.Forte@Sun.COM } 55997836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) 56007836SJohn.Forte@Sun.COM break; 56017836SJohn.Forte@Sun.COM } 56027836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 56037836SJohn.Forte@Sun.COM return (status); 56047836SJohn.Forte@Sun.COM 56057836SJohn.Forte@Sun.COM } 56067836SJohn.Forte@Sun.COM 56077836SJohn.Forte@Sun.COM 56087836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_RegisterForObjectPropertyChanges( 56097836SJohn.Forte@Sun.COM IMA_OBJECT_PROPERTY_FN pClientFn) { 56107836SJohn.Forte@Sun.COM IMA_RegisterForObjectPropertyChangesFn PassFunc; 56117836SJohn.Forte@Sun.COM IMA_UINT i; 56127836SJohn.Forte@Sun.COM IMA_UINT j; 56137836SJohn.Forte@Sun.COM IMA_STATUS status; 56147836SJohn.Forte@Sun.COM 56157836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 56167836SJohn.Forte@Sun.COM InitLibrary(); 56177836SJohn.Forte@Sun.COM 56187836SJohn.Forte@Sun.COM if (pClientFn == NULL) 56197836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 56207836SJohn.Forte@Sun.COM 56217836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 56227836SJohn.Forte@Sun.COM 56237836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 56247836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 56257836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 56267836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 56277836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 56287836SJohn.Forte@Sun.COM if (plugintable[i].number_of_pccallbacks >= 56297836SJohn.Forte@Sun.COM IMA_MAX_CALLBACK_PER_PLUGIN) { 56307836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 56317836SJohn.Forte@Sun.COM continue; 56327836SJohn.Forte@Sun.COM } 56337836SJohn.Forte@Sun.COM 56347836SJohn.Forte@Sun.COM /* check if registered already */ 56357836SJohn.Forte@Sun.COM for (j = 0; 56367836SJohn.Forte@Sun.COM j < plugintable[i].number_of_pccallbacks; 56377836SJohn.Forte@Sun.COM j++) { 56387836SJohn.Forte@Sun.COM if (plugintable[i].pccallback[j] == 56397836SJohn.Forte@Sun.COM pClientFn) { 56407836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 56417836SJohn.Forte@Sun.COM break; 56427836SJohn.Forte@Sun.COM } 56437836SJohn.Forte@Sun.COM } 56447836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 56457836SJohn.Forte@Sun.COM 56467836SJohn.Forte@Sun.COM #ifdef WIN32 56477836SJohn.Forte@Sun.COM PassFunc = 56487836SJohn.Forte@Sun.COM (IMA_RegisterForObjectPropertyChangesFn) 56497836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 56507836SJohn.Forte@Sun.COM "IMA_RegisterForObjectPropertyChanges"); 56517836SJohn.Forte@Sun.COM #else 56527836SJohn.Forte@Sun.COM PassFunc = 56537836SJohn.Forte@Sun.COM (IMA_RegisterForObjectPropertyChangesFn) 56547836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 56557836SJohn.Forte@Sun.COM "IMA_RegisterForObjectPropertyChanges"); 56567836SJohn.Forte@Sun.COM #endif 56577836SJohn.Forte@Sun.COM 56587836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 56597836SJohn.Forte@Sun.COM status = PassFunc(PropertyCallback); 56607836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 56617836SJohn.Forte@Sun.COM j = plugintable[i]. 56627836SJohn.Forte@Sun.COM number_of_pccallbacks; 56637836SJohn.Forte@Sun.COM plugintable[i].pccallback[j] = 56647836SJohn.Forte@Sun.COM pClientFn; 56657836SJohn.Forte@Sun.COM plugintable[i]. 56667836SJohn.Forte@Sun.COM number_of_pccallbacks++; 56677836SJohn.Forte@Sun.COM } 56687836SJohn.Forte@Sun.COM 56697836SJohn.Forte@Sun.COM } 56707836SJohn.Forte@Sun.COM } 56717836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 56727836SJohn.Forte@Sun.COM } 56737836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) 56747836SJohn.Forte@Sun.COM break; 56757836SJohn.Forte@Sun.COM 56767836SJohn.Forte@Sun.COM } 56777836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 56787836SJohn.Forte@Sun.COM return (status); 56797836SJohn.Forte@Sun.COM 56807836SJohn.Forte@Sun.COM } 56817836SJohn.Forte@Sun.COM 56827836SJohn.Forte@Sun.COM 56837836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_DeregisterForObjectPropertyChanges( 56847836SJohn.Forte@Sun.COM IMA_OBJECT_PROPERTY_FN pClientFn) { 56857836SJohn.Forte@Sun.COM IMA_DeregisterForObjectPropertyChangesFn PassFunc; 56867836SJohn.Forte@Sun.COM IMA_UINT i; 56877836SJohn.Forte@Sun.COM IMA_UINT j; 56887836SJohn.Forte@Sun.COM IMA_STATUS status; 56897836SJohn.Forte@Sun.COM 56907836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 56917836SJohn.Forte@Sun.COM InitLibrary(); 56927836SJohn.Forte@Sun.COM 56937836SJohn.Forte@Sun.COM if (pClientFn == NULL) 56947836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 56957836SJohn.Forte@Sun.COM 56967836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 56977836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 56987836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 56997836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 57007836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 57017836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 57027836SJohn.Forte@Sun.COM /* check if deregistered already */ 57037836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 57047836SJohn.Forte@Sun.COM for (j = 0; 57057836SJohn.Forte@Sun.COM j < plugintable[i].number_of_pccallbacks; 57067836SJohn.Forte@Sun.COM j++) { 57077836SJohn.Forte@Sun.COM if (plugintable[i].pccallback[j] == 57087836SJohn.Forte@Sun.COM pClientFn) { 57097836SJohn.Forte@Sun.COM /* 57107836SJohn.Forte@Sun.COM * use IMA_ERROR_UNKNOWN_ERROR 57117836SJohn.Forte@Sun.COM * as a flag 57127836SJohn.Forte@Sun.COM */ 57137836SJohn.Forte@Sun.COM status = IMA_ERROR_UNKNOWN_ERROR; 57147836SJohn.Forte@Sun.COM break; 57157836SJohn.Forte@Sun.COM } 57167836SJohn.Forte@Sun.COM } 57177836SJohn.Forte@Sun.COM 57187836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 57197836SJohn.Forte@Sun.COM 57207836SJohn.Forte@Sun.COM #ifdef WIN32 57217836SJohn.Forte@Sun.COM PassFunc = 57227836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectPropertyChangesFn) 57237836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 57247836SJohn.Forte@Sun.COM "IMA_DeregisterForObjectPropertyChanges"); 57257836SJohn.Forte@Sun.COM 57267836SJohn.Forte@Sun.COM #else 57277836SJohn.Forte@Sun.COM PassFunc = 57287836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectPropertyChangesFn) 57297836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 57307836SJohn.Forte@Sun.COM "IMA_DeregisterForObjectPropertyChanges"); 57317836SJohn.Forte@Sun.COM #endif 57327836SJohn.Forte@Sun.COM 57337836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 57347836SJohn.Forte@Sun.COM status = PassFunc(PropertyCallback); 57357836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 57367836SJohn.Forte@Sun.COM /* 57377836SJohn.Forte@Sun.COM * where plugintable[i].vbcallback[ 57387836SJohn.Forte@Sun.COM * j] == pClientFn 57397836SJohn.Forte@Sun.COM */ 57407836SJohn.Forte@Sun.COM for (; j < plugintable[i]. 57417836SJohn.Forte@Sun.COM number_of_pccallbacks; 57427836SJohn.Forte@Sun.COM j++) { 57437836SJohn.Forte@Sun.COM plugintable[i]. 57447836SJohn.Forte@Sun.COM pccallback[j] 57457836SJohn.Forte@Sun.COM = plugintable[i]. 57467836SJohn.Forte@Sun.COM pccallback[j+1]; 57477836SJohn.Forte@Sun.COM 57487836SJohn.Forte@Sun.COM } 57497836SJohn.Forte@Sun.COM plugintable[i]. 57507836SJohn.Forte@Sun.COM number_of_pccallbacks--; 57517836SJohn.Forte@Sun.COM } 57527836SJohn.Forte@Sun.COM 57537836SJohn.Forte@Sun.COM } 57547836SJohn.Forte@Sun.COM } 57557836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 57567836SJohn.Forte@Sun.COM } 57577836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) 57587836SJohn.Forte@Sun.COM break; 57597836SJohn.Forte@Sun.COM 57607836SJohn.Forte@Sun.COM } 57617836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 57627836SJohn.Forte@Sun.COM return (status); 57637836SJohn.Forte@Sun.COM 57647836SJohn.Forte@Sun.COM } 57657836SJohn.Forte@Sun.COM 57667836SJohn.Forte@Sun.COM 57677836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetIpProperties( 57687836SJohn.Forte@Sun.COM IMA_OID oid, 57697836SJohn.Forte@Sun.COM IMA_IP_PROPERTIES *pProps) { 57707836SJohn.Forte@Sun.COM IMA_GetIpPropertiesFn PassFunc; 57717836SJohn.Forte@Sun.COM IMA_UINT i; 57727836SJohn.Forte@Sun.COM IMA_STATUS status; 57737836SJohn.Forte@Sun.COM 57747836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 57757836SJohn.Forte@Sun.COM InitLibrary(); 57767836SJohn.Forte@Sun.COM 57777836SJohn.Forte@Sun.COM if (pProps == NULL) 57787836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 57797836SJohn.Forte@Sun.COM 57807836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PNP) 57817836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 57827836SJohn.Forte@Sun.COM 57837836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 57847836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 57857836SJohn.Forte@Sun.COM 57867836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 57877836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 57887836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 57897836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 57907836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 57917836SJohn.Forte@Sun.COM #ifdef WIN32 57927836SJohn.Forte@Sun.COM PassFunc = (IMA_GetIpPropertiesFn) 57937836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 57947836SJohn.Forte@Sun.COM "IMA_GetIpProperties"); 57957836SJohn.Forte@Sun.COM #else 57967836SJohn.Forte@Sun.COM PassFunc = (IMA_GetIpPropertiesFn) 57977836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 57987836SJohn.Forte@Sun.COM "IMA_GetIpProperties"); 57997836SJohn.Forte@Sun.COM #endif 58007836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 58017836SJohn.Forte@Sun.COM status = PassFunc(oid, pProps); 58027836SJohn.Forte@Sun.COM } 58037836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 58047836SJohn.Forte@Sun.COM } 58057836SJohn.Forte@Sun.COM 58067836SJohn.Forte@Sun.COM break; 58077836SJohn.Forte@Sun.COM } 58087836SJohn.Forte@Sun.COM } 58097836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 58107836SJohn.Forte@Sun.COM return (status); 58117836SJohn.Forte@Sun.COM } 58127836SJohn.Forte@Sun.COM 58137836SJohn.Forte@Sun.COM 58147836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetIpConfigMethod( 58157836SJohn.Forte@Sun.COM IMA_OID oid, 58167836SJohn.Forte@Sun.COM IMA_BOOL enableDhcpIpConfiguration) { 58177836SJohn.Forte@Sun.COM IMA_SetIpConfigMethodFn PassFunc; 58187836SJohn.Forte@Sun.COM IMA_UINT i; 58197836SJohn.Forte@Sun.COM IMA_STATUS status; 58207836SJohn.Forte@Sun.COM 58217836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 58227836SJohn.Forte@Sun.COM InitLibrary(); 58237836SJohn.Forte@Sun.COM 58247836SJohn.Forte@Sun.COM if (enableDhcpIpConfiguration != IMA_TRUE && 58257836SJohn.Forte@Sun.COM enableDhcpIpConfiguration != IMA_FALSE) 58267836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 58277836SJohn.Forte@Sun.COM 58287836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PNP) 58297836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 58307836SJohn.Forte@Sun.COM 58317836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 58327836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 58337836SJohn.Forte@Sun.COM 58347836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 58357836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 58367836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 58377836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 58387836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 58397836SJohn.Forte@Sun.COM #ifdef WIN32 58407836SJohn.Forte@Sun.COM PassFunc = (IMA_SetIpConfigMethodFn) 58417836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 58427836SJohn.Forte@Sun.COM "IMA_SetIpConfigMethod"); 58437836SJohn.Forte@Sun.COM #else 58447836SJohn.Forte@Sun.COM PassFunc = (IMA_SetIpConfigMethodFn) 58457836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 58467836SJohn.Forte@Sun.COM "IMA_SetIpConfigMethod"); 58477836SJohn.Forte@Sun.COM #endif 58487836SJohn.Forte@Sun.COM 58497836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 58507836SJohn.Forte@Sun.COM status = PassFunc(oid, 58517836SJohn.Forte@Sun.COM enableDhcpIpConfiguration); 58527836SJohn.Forte@Sun.COM } 58537836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 58547836SJohn.Forte@Sun.COM } 58557836SJohn.Forte@Sun.COM 58567836SJohn.Forte@Sun.COM break; 58577836SJohn.Forte@Sun.COM } 58587836SJohn.Forte@Sun.COM } 58597836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 58607836SJohn.Forte@Sun.COM return (status); 58617836SJohn.Forte@Sun.COM } 58627836SJohn.Forte@Sun.COM 58637836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetSubnetMask( 58647836SJohn.Forte@Sun.COM IMA_OID oid, 58657836SJohn.Forte@Sun.COM IMA_IP_ADDRESS subnetMask) { 58667836SJohn.Forte@Sun.COM IMA_SetSubnetMaskFn PassFunc; 58677836SJohn.Forte@Sun.COM IMA_UINT i; 58687836SJohn.Forte@Sun.COM IMA_STATUS status; 58697836SJohn.Forte@Sun.COM 58707836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 58717836SJohn.Forte@Sun.COM InitLibrary(); 58727836SJohn.Forte@Sun.COM 58737836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PNP) 58747836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 58757836SJohn.Forte@Sun.COM 58767836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 58777836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 58787836SJohn.Forte@Sun.COM 58797836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 58807836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 58817836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 58827836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 58837836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 58847836SJohn.Forte@Sun.COM #ifdef WIN32 58857836SJohn.Forte@Sun.COM PassFunc = (IMA_SetSubnetMaskFn) 58867836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 58877836SJohn.Forte@Sun.COM "IMA_SetSubnetMask"); 58887836SJohn.Forte@Sun.COM #else 58897836SJohn.Forte@Sun.COM PassFunc = (IMA_SetSubnetMaskFn) 58907836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 58917836SJohn.Forte@Sun.COM "IMA_SetSubnetMask"); 58927836SJohn.Forte@Sun.COM #endif 58937836SJohn.Forte@Sun.COM 58947836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 58957836SJohn.Forte@Sun.COM status = PassFunc(oid, subnetMask); 58967836SJohn.Forte@Sun.COM } 58977836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 58987836SJohn.Forte@Sun.COM } 58997836SJohn.Forte@Sun.COM 59007836SJohn.Forte@Sun.COM break; 59017836SJohn.Forte@Sun.COM } 59027836SJohn.Forte@Sun.COM } 59037836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 59047836SJohn.Forte@Sun.COM return (status); 59057836SJohn.Forte@Sun.COM } 59067836SJohn.Forte@Sun.COM 59077836SJohn.Forte@Sun.COM 59087836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetDnsServerAddress( 59097836SJohn.Forte@Sun.COM IMA_OID oid, 59107836SJohn.Forte@Sun.COM const IMA_IP_ADDRESS *primaryDnsServerAddress, 59117836SJohn.Forte@Sun.COM const IMA_IP_ADDRESS *alternateDnsServerAddress) { 59127836SJohn.Forte@Sun.COM IMA_SetDnsServerAddressFn PassFunc; 59137836SJohn.Forte@Sun.COM IMA_UINT i; 59147836SJohn.Forte@Sun.COM IMA_STATUS status; 59157836SJohn.Forte@Sun.COM 59167836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 59177836SJohn.Forte@Sun.COM InitLibrary(); 59187836SJohn.Forte@Sun.COM 59197836SJohn.Forte@Sun.COM if (primaryDnsServerAddress == NULL && 59207836SJohn.Forte@Sun.COM alternateDnsServerAddress != NULL) 59217836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 59227836SJohn.Forte@Sun.COM 59237836SJohn.Forte@Sun.COM if (primaryDnsServerAddress != NULL && 59247836SJohn.Forte@Sun.COM alternateDnsServerAddress != NULL && 59257836SJohn.Forte@Sun.COM memcmp(primaryDnsServerAddress->ipAddress, 59267836SJohn.Forte@Sun.COM alternateDnsServerAddress->ipAddress, 59277836SJohn.Forte@Sun.COM sizeof (primaryDnsServerAddress->ipAddress)) == 0) 59287836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 59297836SJohn.Forte@Sun.COM 59307836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PNP) 59317836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 59327836SJohn.Forte@Sun.COM 59337836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 59347836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 59357836SJohn.Forte@Sun.COM 59367836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 59377836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 59387836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 59397836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 59407836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 59417836SJohn.Forte@Sun.COM #ifdef WIN32 59427836SJohn.Forte@Sun.COM PassFunc = (IMA_SetDnsServerAddressFn) 59437836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 59447836SJohn.Forte@Sun.COM "IMA_SetDnsServerAddress"); 59457836SJohn.Forte@Sun.COM #else 59467836SJohn.Forte@Sun.COM PassFunc = (IMA_SetDnsServerAddressFn) 59477836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 59487836SJohn.Forte@Sun.COM "IMA_SetDnsServerAddress"); 59497836SJohn.Forte@Sun.COM #endif 59507836SJohn.Forte@Sun.COM 59517836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 59527836SJohn.Forte@Sun.COM status = PassFunc(oid, 59537836SJohn.Forte@Sun.COM primaryDnsServerAddress, 59547836SJohn.Forte@Sun.COM alternateDnsServerAddress); 59557836SJohn.Forte@Sun.COM } 59567836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 59577836SJohn.Forte@Sun.COM } 59587836SJohn.Forte@Sun.COM 59597836SJohn.Forte@Sun.COM break; 59607836SJohn.Forte@Sun.COM } 59617836SJohn.Forte@Sun.COM } 59627836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 59637836SJohn.Forte@Sun.COM return (status); 59647836SJohn.Forte@Sun.COM } 59657836SJohn.Forte@Sun.COM 59667836SJohn.Forte@Sun.COM 59677836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetDefaultGateway( 59687836SJohn.Forte@Sun.COM IMA_OID oid, 59697836SJohn.Forte@Sun.COM IMA_IP_ADDRESS defaultGateway) { 59707836SJohn.Forte@Sun.COM IMA_SetDefaultGatewayFn PassFunc; 59717836SJohn.Forte@Sun.COM IMA_UINT i; 59727836SJohn.Forte@Sun.COM IMA_STATUS status; 59737836SJohn.Forte@Sun.COM 59747836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 59757836SJohn.Forte@Sun.COM InitLibrary(); 59767836SJohn.Forte@Sun.COM 59777836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PNP) 59787836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 59797836SJohn.Forte@Sun.COM 59807836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 59817836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 59827836SJohn.Forte@Sun.COM 59837836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 59847836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 59857836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 59867836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 59877836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 59887836SJohn.Forte@Sun.COM #ifdef WIN32 59897836SJohn.Forte@Sun.COM PassFunc = (IMA_SetDefaultGatewayFn) 59907836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 59917836SJohn.Forte@Sun.COM "IMA_SetDefaultGateway"); 59927836SJohn.Forte@Sun.COM #else 59937836SJohn.Forte@Sun.COM PassFunc = (IMA_SetDefaultGatewayFn) 59947836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 59957836SJohn.Forte@Sun.COM "IMA_SetDefaultGateway"); 59967836SJohn.Forte@Sun.COM #endif 59977836SJohn.Forte@Sun.COM 59987836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 59997836SJohn.Forte@Sun.COM status = PassFunc(oid, defaultGateway); 60007836SJohn.Forte@Sun.COM } 60017836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 60027836SJohn.Forte@Sun.COM } 60037836SJohn.Forte@Sun.COM 60047836SJohn.Forte@Sun.COM break; 60057836SJohn.Forte@Sun.COM } 60067836SJohn.Forte@Sun.COM } 60077836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 60087836SJohn.Forte@Sun.COM return (status); 60097836SJohn.Forte@Sun.COM } 60107836SJohn.Forte@Sun.COM 60117836SJohn.Forte@Sun.COM 60127836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetSupportedAuthMethods( 60137836SJohn.Forte@Sun.COM IMA_OID lhbaOid, 60147836SJohn.Forte@Sun.COM IMA_BOOL getSettableMethods, 60157836SJohn.Forte@Sun.COM IMA_UINT *pMethodCount, 60167836SJohn.Forte@Sun.COM IMA_AUTHMETHOD *pMethodList) { 60177836SJohn.Forte@Sun.COM IMA_GetSupportedAuthMethodsFn PassFunc; 60187836SJohn.Forte@Sun.COM IMA_UINT i; 60197836SJohn.Forte@Sun.COM IMA_STATUS status; 60207836SJohn.Forte@Sun.COM 60217836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 60227836SJohn.Forte@Sun.COM InitLibrary(); 60237836SJohn.Forte@Sun.COM 60247836SJohn.Forte@Sun.COM if (pMethodCount == NULL) 60257836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 60267836SJohn.Forte@Sun.COM 60277836SJohn.Forte@Sun.COM if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) 60287836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 60297836SJohn.Forte@Sun.COM 60307836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 60317836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 60327836SJohn.Forte@Sun.COM 60337836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 60347836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaOid.ownerId) { 60357836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 60367836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 60377836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 60387836SJohn.Forte@Sun.COM #ifdef WIN32 60397836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSupportedAuthMethodsFn) 60407836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 60417836SJohn.Forte@Sun.COM "IMA_GetSupportedAuthMethods"); 60427836SJohn.Forte@Sun.COM #else 60437836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSupportedAuthMethodsFn) 60447836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 60457836SJohn.Forte@Sun.COM "IMA_GetSupportedAuthMethods"); 60467836SJohn.Forte@Sun.COM #endif 60477836SJohn.Forte@Sun.COM 60487836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 60497836SJohn.Forte@Sun.COM status = PassFunc(lhbaOid, 60507836SJohn.Forte@Sun.COM getSettableMethods, 60517836SJohn.Forte@Sun.COM pMethodCount, pMethodList); 60527836SJohn.Forte@Sun.COM } 60537836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 60547836SJohn.Forte@Sun.COM } 60557836SJohn.Forte@Sun.COM 60567836SJohn.Forte@Sun.COM break; 60577836SJohn.Forte@Sun.COM } 60587836SJohn.Forte@Sun.COM } 60597836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 60607836SJohn.Forte@Sun.COM return (status); 60617836SJohn.Forte@Sun.COM } 60627836SJohn.Forte@Sun.COM 60637836SJohn.Forte@Sun.COM 60647836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetInUseInitiatorAuthMethods( 60657836SJohn.Forte@Sun.COM IMA_OID lhbaOid, 60667836SJohn.Forte@Sun.COM IMA_UINT *pMethodCount, 60677836SJohn.Forte@Sun.COM IMA_AUTHMETHOD *pMethodList) { 60687836SJohn.Forte@Sun.COM IMA_GetInUseInitiatorAuthMethodsFn PassFunc; 60697836SJohn.Forte@Sun.COM IMA_UINT i; 60707836SJohn.Forte@Sun.COM IMA_STATUS status; 60717836SJohn.Forte@Sun.COM 60727836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 60737836SJohn.Forte@Sun.COM InitLibrary(); 60747836SJohn.Forte@Sun.COM 60757836SJohn.Forte@Sun.COM if (pMethodCount == NULL) 60767836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 60777836SJohn.Forte@Sun.COM 60787836SJohn.Forte@Sun.COM if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) 60797836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 60807836SJohn.Forte@Sun.COM 60817836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 60827836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 60837836SJohn.Forte@Sun.COM 60847836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 60857836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaOid.ownerId) { 60867836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 60877836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 60887836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 60897836SJohn.Forte@Sun.COM #ifdef WIN32 60907836SJohn.Forte@Sun.COM PassFunc = (IMA_GetInUseInitiatorAuthMethodsFn) 60917836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 60927836SJohn.Forte@Sun.COM "IMA_GetInUseInitiatorAuthMethods"); 60937836SJohn.Forte@Sun.COM #else 60947836SJohn.Forte@Sun.COM PassFunc = (IMA_GetInUseInitiatorAuthMethodsFn) 60957836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 60967836SJohn.Forte@Sun.COM "IMA_GetInUseInitiatorAuthMethods"); 60977836SJohn.Forte@Sun.COM #endif 60987836SJohn.Forte@Sun.COM 60997836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 61007836SJohn.Forte@Sun.COM status = PassFunc(lhbaOid, 61017836SJohn.Forte@Sun.COM pMethodCount, pMethodList); 61027836SJohn.Forte@Sun.COM } 61037836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 61047836SJohn.Forte@Sun.COM } 61057836SJohn.Forte@Sun.COM 61067836SJohn.Forte@Sun.COM break; 61077836SJohn.Forte@Sun.COM } 61087836SJohn.Forte@Sun.COM } 61097836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 61107836SJohn.Forte@Sun.COM return (status); 61117836SJohn.Forte@Sun.COM } 61127836SJohn.Forte@Sun.COM 61137836SJohn.Forte@Sun.COM 61147836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetInitiatorAuthParms( 61157836SJohn.Forte@Sun.COM IMA_OID lhbaOid, 61167836SJohn.Forte@Sun.COM IMA_AUTHMETHOD method, 61177836SJohn.Forte@Sun.COM IMA_INITIATOR_AUTHPARMS *pParms) { 61187836SJohn.Forte@Sun.COM IMA_GetInitiatorAuthParmsFn PassFunc; 61197836SJohn.Forte@Sun.COM IMA_UINT i; 61207836SJohn.Forte@Sun.COM IMA_STATUS status; 61217836SJohn.Forte@Sun.COM 61227836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 61237836SJohn.Forte@Sun.COM InitLibrary(); 61247836SJohn.Forte@Sun.COM 61257836SJohn.Forte@Sun.COM if (pParms == NULL) 61267836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 61277836SJohn.Forte@Sun.COM 61287836SJohn.Forte@Sun.COM if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) 61297836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 61307836SJohn.Forte@Sun.COM 61317836SJohn.Forte@Sun.COM if (method != IMA_AUTHMETHOD_NONE && 61327836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_CHAP && 61337836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_SRP && 61347836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_KRB5 && 61357836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_SPKM1 && 61367836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_SPKM2) 61377836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 61387836SJohn.Forte@Sun.COM 61397836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 61407836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 61417836SJohn.Forte@Sun.COM 61427836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 61437836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaOid.ownerId) { 61447836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 61457836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 61467836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 61477836SJohn.Forte@Sun.COM #ifdef WIN32 61487836SJohn.Forte@Sun.COM PassFunc = (IMA_GetInitiatorAuthParmsFn) 61497836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 61507836SJohn.Forte@Sun.COM "IMA_GetInitiatorAuthParms"); 61517836SJohn.Forte@Sun.COM #else 61527836SJohn.Forte@Sun.COM PassFunc = (IMA_GetInitiatorAuthParmsFn) 61537836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 61547836SJohn.Forte@Sun.COM "IMA_GetInitiatorAuthParms"); 61557836SJohn.Forte@Sun.COM #endif 61567836SJohn.Forte@Sun.COM 61577836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 61587836SJohn.Forte@Sun.COM status = PassFunc(lhbaOid, 61597836SJohn.Forte@Sun.COM method, pParms); 61607836SJohn.Forte@Sun.COM } 61617836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 61627836SJohn.Forte@Sun.COM } 61637836SJohn.Forte@Sun.COM 61647836SJohn.Forte@Sun.COM break; 61657836SJohn.Forte@Sun.COM } 61667836SJohn.Forte@Sun.COM } 61677836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 61687836SJohn.Forte@Sun.COM return (status); 61697836SJohn.Forte@Sun.COM } 61707836SJohn.Forte@Sun.COM 61717836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetInitiatorAuthMethods( 61727836SJohn.Forte@Sun.COM IMA_OID lhbaOid, 61737836SJohn.Forte@Sun.COM IMA_UINT methodCount, 61747836SJohn.Forte@Sun.COM const IMA_AUTHMETHOD *pMethodList) { 61757836SJohn.Forte@Sun.COM IMA_SetInitiatorAuthMethodsFn PassFunc; 61767836SJohn.Forte@Sun.COM IMA_UINT i; 61777836SJohn.Forte@Sun.COM IMA_STATUS status; 61787836SJohn.Forte@Sun.COM 61797836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 61807836SJohn.Forte@Sun.COM InitLibrary(); 61817836SJohn.Forte@Sun.COM 61827836SJohn.Forte@Sun.COM if (methodCount == 0 || pMethodList == NULL) 61837836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 61847836SJohn.Forte@Sun.COM 61857836SJohn.Forte@Sun.COM if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) 61867836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 61877836SJohn.Forte@Sun.COM 61887836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 61897836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 61907836SJohn.Forte@Sun.COM 61917836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 61927836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaOid.ownerId) { 61937836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 61947836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 61957836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 61967836SJohn.Forte@Sun.COM #ifdef WIN32 61977836SJohn.Forte@Sun.COM PassFunc = (IMA_SetInitiatorAuthMethodsFn) 61987836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 61997836SJohn.Forte@Sun.COM "IMA_SetInitiatorAuthMethods"); 62007836SJohn.Forte@Sun.COM #else 62017836SJohn.Forte@Sun.COM PassFunc = (IMA_SetInitiatorAuthMethodsFn) 62027836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 62037836SJohn.Forte@Sun.COM "IMA_SetInitiatorAuthMethods"); 62047836SJohn.Forte@Sun.COM #endif 62057836SJohn.Forte@Sun.COM 62067836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 62077836SJohn.Forte@Sun.COM status = PassFunc(lhbaOid, 62087836SJohn.Forte@Sun.COM methodCount, pMethodList); 62097836SJohn.Forte@Sun.COM } 62107836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 62117836SJohn.Forte@Sun.COM } 62127836SJohn.Forte@Sun.COM 62137836SJohn.Forte@Sun.COM break; 62147836SJohn.Forte@Sun.COM } 62157836SJohn.Forte@Sun.COM } 62167836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 62177836SJohn.Forte@Sun.COM return (status); 62187836SJohn.Forte@Sun.COM } 62197836SJohn.Forte@Sun.COM 62207836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetInitiatorAuthParms( 62217836SJohn.Forte@Sun.COM IMA_OID lhbaOid, 62227836SJohn.Forte@Sun.COM IMA_AUTHMETHOD method, 62237836SJohn.Forte@Sun.COM const IMA_INITIATOR_AUTHPARMS *pParms) { 62247836SJohn.Forte@Sun.COM 62257836SJohn.Forte@Sun.COM IMA_SetInitiatorAuthParmsFn PassFunc; 62267836SJohn.Forte@Sun.COM IMA_UINT i; 62277836SJohn.Forte@Sun.COM IMA_STATUS status; 62287836SJohn.Forte@Sun.COM 62297836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 62307836SJohn.Forte@Sun.COM InitLibrary(); 62317836SJohn.Forte@Sun.COM 62327836SJohn.Forte@Sun.COM if (pParms == NULL) 62337836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 62347836SJohn.Forte@Sun.COM 62357836SJohn.Forte@Sun.COM if (method != IMA_AUTHMETHOD_NONE && 62367836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_CHAP && 62377836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_SRP && 62387836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_KRB5 && 62397836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_SPKM1 && 62407836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_SPKM2) 62417836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 62427836SJohn.Forte@Sun.COM 62437836SJohn.Forte@Sun.COM if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) 62447836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 62457836SJohn.Forte@Sun.COM 62467836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 62477836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 62487836SJohn.Forte@Sun.COM 62497836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 62507836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaOid.ownerId) { 62517836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 62527836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 62537836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 62547836SJohn.Forte@Sun.COM #ifdef WIN32 62557836SJohn.Forte@Sun.COM PassFunc = (IMA_SetInitiatorAuthParmsFn) 62567836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 62577836SJohn.Forte@Sun.COM "IMA_SetInitiatorAuthParms"); 62587836SJohn.Forte@Sun.COM #else 62597836SJohn.Forte@Sun.COM PassFunc = (IMA_SetInitiatorAuthParmsFn) 62607836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 62617836SJohn.Forte@Sun.COM "IMA_SetInitiatorAuthParms"); 62627836SJohn.Forte@Sun.COM #endif 62637836SJohn.Forte@Sun.COM 62647836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 62657836SJohn.Forte@Sun.COM status = 62667836SJohn.Forte@Sun.COM PassFunc( 62677836SJohn.Forte@Sun.COM lhbaOid, method, pParms); 62687836SJohn.Forte@Sun.COM } 62697836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 62707836SJohn.Forte@Sun.COM } 62717836SJohn.Forte@Sun.COM 62727836SJohn.Forte@Sun.COM break; 62737836SJohn.Forte@Sun.COM } 62747836SJohn.Forte@Sun.COM } 62757836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 62767836SJohn.Forte@Sun.COM return (status); 62777836SJohn.Forte@Sun.COM } 62787836SJohn.Forte@Sun.COM 62797836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetStaticDiscoveryTargetOidList( 62807836SJohn.Forte@Sun.COM IMA_OID oid, 62817836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 62827836SJohn.Forte@Sun.COM IMA_GetStaticDiscoveryTargetOidListFn PassFunc; 62837836SJohn.Forte@Sun.COM IMA_UINT i; 62847836SJohn.Forte@Sun.COM IMA_STATUS status; 62857836SJohn.Forte@Sun.COM 62867836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 62877836SJohn.Forte@Sun.COM InitLibrary(); 62887836SJohn.Forte@Sun.COM 62897836SJohn.Forte@Sun.COM if (ppList == NULL) 62907836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 62917836SJohn.Forte@Sun.COM 62927836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_LHBA && 62937836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PNP) 62947836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 62957836SJohn.Forte@Sun.COM 62967836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 62977836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 62987836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 62997836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 63007836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 63017836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 63027836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 63037836SJohn.Forte@Sun.COM #ifdef WIN32 63047836SJohn.Forte@Sun.COM PassFunc = 63057836SJohn.Forte@Sun.COM (IMA_GetStaticDiscoveryTargetOidListFn) 63067836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 63077836SJohn.Forte@Sun.COM "IMA_GetStaticDiscoveryTargetOidList"); 63087836SJohn.Forte@Sun.COM #else 63097836SJohn.Forte@Sun.COM PassFunc = 63107836SJohn.Forte@Sun.COM (IMA_GetStaticDiscoveryTargetOidListFn) 63117836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 63127836SJohn.Forte@Sun.COM "IMA_GetStaticDiscoveryTargetOidList"); 63137836SJohn.Forte@Sun.COM #endif 63147836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 63157836SJohn.Forte@Sun.COM status = PassFunc(oid, ppList); 63167836SJohn.Forte@Sun.COM } 63177836SJohn.Forte@Sun.COM 63187836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 63197836SJohn.Forte@Sun.COM } 63207836SJohn.Forte@Sun.COM 63217836SJohn.Forte@Sun.COM break; 63227836SJohn.Forte@Sun.COM } 63237836SJohn.Forte@Sun.COM } 63247836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 63257836SJohn.Forte@Sun.COM return (status); 63267836SJohn.Forte@Sun.COM } 63277836SJohn.Forte@Sun.COM 63287836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDiscoveryProperties( 63297836SJohn.Forte@Sun.COM IMA_OID oid, 63307836SJohn.Forte@Sun.COM IMA_DISCOVERY_PROPERTIES *pProps) { 63317836SJohn.Forte@Sun.COM IMA_GetDiscoveryPropertiesFn PassFunc; 63327836SJohn.Forte@Sun.COM IMA_UINT i; 63337836SJohn.Forte@Sun.COM IMA_STATUS status; 63347836SJohn.Forte@Sun.COM 63357836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 63367836SJohn.Forte@Sun.COM InitLibrary(); 63377836SJohn.Forte@Sun.COM 63387836SJohn.Forte@Sun.COM if (pProps == NULL) 63397836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 63407836SJohn.Forte@Sun.COM 63417836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PHBA && 63427836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_LHBA) 63437836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 63447836SJohn.Forte@Sun.COM 63457836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 63467836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 63477836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 63487836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 63497836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 63507836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 63517836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 63527836SJohn.Forte@Sun.COM #ifdef WIN32 63537836SJohn.Forte@Sun.COM PassFunc = (IMA_GetDiscoveryPropertiesFn) 63547836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 63557836SJohn.Forte@Sun.COM "IMA_GetDiscoveryProperties"); 63567836SJohn.Forte@Sun.COM #else 63577836SJohn.Forte@Sun.COM PassFunc = (IMA_GetDiscoveryPropertiesFn) 63587836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 63597836SJohn.Forte@Sun.COM "IMA_GetDiscoveryProperties"); 63607836SJohn.Forte@Sun.COM #endif 63617836SJohn.Forte@Sun.COM 63627836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 63637836SJohn.Forte@Sun.COM status = PassFunc(oid, pProps); 63647836SJohn.Forte@Sun.COM } 63657836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 63667836SJohn.Forte@Sun.COM } 63677836SJohn.Forte@Sun.COM 63687836SJohn.Forte@Sun.COM break; 63697836SJohn.Forte@Sun.COM } 63707836SJohn.Forte@Sun.COM } 63717836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 63727836SJohn.Forte@Sun.COM return (status); 63737836SJohn.Forte@Sun.COM } 63747836SJohn.Forte@Sun.COM 63757836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_AddDiscoveryAddress( 63767836SJohn.Forte@Sun.COM IMA_OID oid, 63777836SJohn.Forte@Sun.COM const IMA_TARGET_ADDRESS discoveryAddress, 63787836SJohn.Forte@Sun.COM IMA_OID *pDiscoveryAddressOid) { 63797836SJohn.Forte@Sun.COM IMA_AddDiscoveryAddressFn PassFunc; 63807836SJohn.Forte@Sun.COM IMA_UINT i; 63817836SJohn.Forte@Sun.COM IMA_STATUS status; 63827836SJohn.Forte@Sun.COM 63837836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 63847836SJohn.Forte@Sun.COM InitLibrary(); 63857836SJohn.Forte@Sun.COM 63867836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_LHBA && 63877836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PNP) 63887836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 63897836SJohn.Forte@Sun.COM 63907836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 63917836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 63927836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 63937836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 63947836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 63957836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 63967836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 63977836SJohn.Forte@Sun.COM #ifdef WIN32 63987836SJohn.Forte@Sun.COM PassFunc = (IMA_AddDiscoveryAddressFn) 63997836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 64007836SJohn.Forte@Sun.COM "IMA_AddDiscoveryAddress"); 64017836SJohn.Forte@Sun.COM #else 64027836SJohn.Forte@Sun.COM PassFunc = (IMA_AddDiscoveryAddressFn) 64037836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 64047836SJohn.Forte@Sun.COM "IMA_AddDiscoveryAddress"); 64057836SJohn.Forte@Sun.COM #endif 64067836SJohn.Forte@Sun.COM 64077836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 64087836SJohn.Forte@Sun.COM status = PassFunc(oid, 64097836SJohn.Forte@Sun.COM discoveryAddress, 64107836SJohn.Forte@Sun.COM pDiscoveryAddressOid); 64117836SJohn.Forte@Sun.COM } 64127836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 64137836SJohn.Forte@Sun.COM } 64147836SJohn.Forte@Sun.COM 64157836SJohn.Forte@Sun.COM break; 64167836SJohn.Forte@Sun.COM } 64177836SJohn.Forte@Sun.COM } 64187836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 64197836SJohn.Forte@Sun.COM return (status); 64207836SJohn.Forte@Sun.COM } 64217836SJohn.Forte@Sun.COM 64227836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_AddStaticDiscoveryTarget( 64237836SJohn.Forte@Sun.COM IMA_OID oid, 64247836SJohn.Forte@Sun.COM const IMA_STATIC_DISCOVERY_TARGET staticDiscoveryTarget, 64257836SJohn.Forte@Sun.COM IMA_OID *pStaticDiscoveryTargetOid) { 64267836SJohn.Forte@Sun.COM IMA_AddStaticDiscoveryTargetFn PassFunc; 64277836SJohn.Forte@Sun.COM IMA_UINT i; 64287836SJohn.Forte@Sun.COM IMA_STATUS status; 64297836SJohn.Forte@Sun.COM 64307836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 64317836SJohn.Forte@Sun.COM InitLibrary(); 64327836SJohn.Forte@Sun.COM 64337836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_LHBA && 64347836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PNP) 64357836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 64367836SJohn.Forte@Sun.COM 64377836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 64387836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 64397836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 64407836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 64417836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 64427836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 64437836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 64447836SJohn.Forte@Sun.COM #ifdef WIN32 64457836SJohn.Forte@Sun.COM PassFunc = (IMA_AddStaticDiscoveryTargetFn) 64467836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 64477836SJohn.Forte@Sun.COM "IMA_AddStaticDiscoveryTarget"); 64487836SJohn.Forte@Sun.COM 64497836SJohn.Forte@Sun.COM #else 64507836SJohn.Forte@Sun.COM PassFunc = (IMA_AddStaticDiscoveryTargetFn) 64517836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 64527836SJohn.Forte@Sun.COM "IMA_AddStaticDiscoveryTarget"); 64537836SJohn.Forte@Sun.COM #endif 64547836SJohn.Forte@Sun.COM 64557836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 64567836SJohn.Forte@Sun.COM status = PassFunc(oid, 64577836SJohn.Forte@Sun.COM staticDiscoveryTarget, 64587836SJohn.Forte@Sun.COM pStaticDiscoveryTargetOid); 64597836SJohn.Forte@Sun.COM } 64607836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 64617836SJohn.Forte@Sun.COM } 64627836SJohn.Forte@Sun.COM 64637836SJohn.Forte@Sun.COM break; 64647836SJohn.Forte@Sun.COM } 64657836SJohn.Forte@Sun.COM } 64667836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 64677836SJohn.Forte@Sun.COM return (status); 64687836SJohn.Forte@Sun.COM } 64697836SJohn.Forte@Sun.COM 64707836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_CommitHbaParameters(IMA_OID oid, 64717836SJohn.Forte@Sun.COM IMA_COMMIT_LEVEL commitLevel) 64727836SJohn.Forte@Sun.COM { 64737836SJohn.Forte@Sun.COM IMA_CommitHbaParametersFn PassFunc; 64747836SJohn.Forte@Sun.COM IMA_UINT i; 64757836SJohn.Forte@Sun.COM IMA_STATUS status; 64767836SJohn.Forte@Sun.COM 64777836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 64787836SJohn.Forte@Sun.COM InitLibrary(); 64797836SJohn.Forte@Sun.COM 64807836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_LHBA && 64817836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PHBA) 64827836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 64837836SJohn.Forte@Sun.COM 64847836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 64857836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 64867836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 64877836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 64887836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 64897836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 64907836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 64917836SJohn.Forte@Sun.COM #ifdef WIN32 64927836SJohn.Forte@Sun.COM PassFunc = (IMA_CommitHbaParametersFn) 64937836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 64947836SJohn.Forte@Sun.COM "IMA_CommitHbaParameters"); 64957836SJohn.Forte@Sun.COM #else 64967836SJohn.Forte@Sun.COM PassFunc = (IMA_CommitHbaParametersFn) 64977836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 64987836SJohn.Forte@Sun.COM "IMA_CommitHbaParameters"); 64997836SJohn.Forte@Sun.COM #endif 65007836SJohn.Forte@Sun.COM 65017836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 65027836SJohn.Forte@Sun.COM status = PassFunc(oid, commitLevel); 65037836SJohn.Forte@Sun.COM } 65047836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 65057836SJohn.Forte@Sun.COM } 65067836SJohn.Forte@Sun.COM 65077836SJohn.Forte@Sun.COM break; 65087836SJohn.Forte@Sun.COM } 65097836SJohn.Forte@Sun.COM } 65107836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 65117836SJohn.Forte@Sun.COM return (status); 65127836SJohn.Forte@Sun.COM } 65137836SJohn.Forte@Sun.COM 65147836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_RemoveStaticDiscoveryTarget( 65157836SJohn.Forte@Sun.COM IMA_OID oid) { 65167836SJohn.Forte@Sun.COM IMA_RemoveStaticDiscoveryTargetFn PassFunc; 65177836SJohn.Forte@Sun.COM IMA_UINT i; 65187836SJohn.Forte@Sun.COM IMA_STATUS status; 65197836SJohn.Forte@Sun.COM 65207836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 65217836SJohn.Forte@Sun.COM InitLibrary(); 65227836SJohn.Forte@Sun.COM 65237836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET) 65247836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 65257836SJohn.Forte@Sun.COM 65267836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 65277836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 65287836SJohn.Forte@Sun.COM 65297836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 65307836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 65317836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 65327836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 65337836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 65347836SJohn.Forte@Sun.COM #ifdef WIN32 65357836SJohn.Forte@Sun.COM PassFunc = (IMA_RemoveStaticDiscoveryTargetFn) 65367836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 65377836SJohn.Forte@Sun.COM "IMA_RemoveStaticDiscoveryTarget"); 65387836SJohn.Forte@Sun.COM #else 65397836SJohn.Forte@Sun.COM PassFunc = (IMA_RemoveStaticDiscoveryTargetFn) 65407836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 65417836SJohn.Forte@Sun.COM "IMA_RemoveStaticDiscoveryTarget"); 65427836SJohn.Forte@Sun.COM #endif 65437836SJohn.Forte@Sun.COM 65447836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 65457836SJohn.Forte@Sun.COM status = PassFunc(oid); 65467836SJohn.Forte@Sun.COM } 65477836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 65487836SJohn.Forte@Sun.COM } 65497836SJohn.Forte@Sun.COM 65507836SJohn.Forte@Sun.COM break; 65517836SJohn.Forte@Sun.COM } 65527836SJohn.Forte@Sun.COM } 65537836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 65547836SJohn.Forte@Sun.COM return (status); 65557836SJohn.Forte@Sun.COM } 65567836SJohn.Forte@Sun.COM 65577836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetStaticDiscoveryTargetProperties( 65587836SJohn.Forte@Sun.COM IMA_OID staticDiscoveryTargetOid, 65597836SJohn.Forte@Sun.COM IMA_STATIC_DISCOVERY_TARGET_PROPERTIES *pProps) { 65607836SJohn.Forte@Sun.COM IMA_GetStaticDiscoveryTargetPropertiesFn PassFunc; 65617836SJohn.Forte@Sun.COM IMA_UINT i; 65627836SJohn.Forte@Sun.COM IMA_STATUS status; 65637836SJohn.Forte@Sun.COM 65647836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 65657836SJohn.Forte@Sun.COM InitLibrary(); 65667836SJohn.Forte@Sun.COM 65677836SJohn.Forte@Sun.COM if (pProps == NULL) 65687836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 65697836SJohn.Forte@Sun.COM 65707836SJohn.Forte@Sun.COM if (staticDiscoveryTargetOid.objectType != 65717836SJohn.Forte@Sun.COM IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET) 65727836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 65737836SJohn.Forte@Sun.COM 65747836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 65757836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 65767836SJohn.Forte@Sun.COM 65777836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 65787836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == 65797836SJohn.Forte@Sun.COM staticDiscoveryTargetOid.ownerId) { 65807836SJohn.Forte@Sun.COM 65817836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 65827836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 65837836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 65847836SJohn.Forte@Sun.COM #ifdef WIN32 65857836SJohn.Forte@Sun.COM PassFunc = 65867836SJohn.Forte@Sun.COM (IMA_GetStaticDiscoveryTargetPropertiesFn) 65877836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 65887836SJohn.Forte@Sun.COM "IMA_GetStaticDiscoveryTargetProperties"); 65897836SJohn.Forte@Sun.COM #else 65907836SJohn.Forte@Sun.COM PassFunc = 65917836SJohn.Forte@Sun.COM (IMA_GetStaticDiscoveryTargetPropertiesFn) 65927836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 65937836SJohn.Forte@Sun.COM "IMA_GetStaticDiscoveryTargetProperties"); 65947836SJohn.Forte@Sun.COM #endif 65957836SJohn.Forte@Sun.COM 65967836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 65977836SJohn.Forte@Sun.COM status = PassFunc( 65987836SJohn.Forte@Sun.COM staticDiscoveryTargetOid, pProps); 65997836SJohn.Forte@Sun.COM } 66007836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 66017836SJohn.Forte@Sun.COM } 66027836SJohn.Forte@Sun.COM 66037836SJohn.Forte@Sun.COM break; 66047836SJohn.Forte@Sun.COM } 66057836SJohn.Forte@Sun.COM } 66067836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 66077836SJohn.Forte@Sun.COM return (status); 66087836SJohn.Forte@Sun.COM } 66097836SJohn.Forte@Sun.COM 66107836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDiscoveryAddressOidList( 66117836SJohn.Forte@Sun.COM IMA_OID Oid, 66127836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 66137836SJohn.Forte@Sun.COM 66147836SJohn.Forte@Sun.COM IMA_GetDiscoveryAddressOidListFn PassFunc; 66157836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 66167836SJohn.Forte@Sun.COM 66177836SJohn.Forte@Sun.COM IMA_UINT i; 66187836SJohn.Forte@Sun.COM IMA_UINT j; 66197836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 66207836SJohn.Forte@Sun.COM IMA_STATUS status; 66217836SJohn.Forte@Sun.COM 66227836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 66237836SJohn.Forte@Sun.COM InitLibrary(); 66247836SJohn.Forte@Sun.COM 66257836SJohn.Forte@Sun.COM if (ppList == NULL) 66267836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 66277836SJohn.Forte@Sun.COM 66287836SJohn.Forte@Sun.COM if ((Oid.objectType != IMA_OBJECT_TYPE_LHBA) && 66297836SJohn.Forte@Sun.COM (Oid.objectType != IMA_OBJECT_TYPE_PNP)) { 66307836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 66317836SJohn.Forte@Sun.COM } 66327836SJohn.Forte@Sun.COM 66337836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 66347836SJohn.Forte@Sun.COM // Get total id count first 66357836SJohn.Forte@Sun.COM totalIdCount = 0; 66367836SJohn.Forte@Sun.COM 66377836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 66387836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 66397836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 66407836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 66417836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 66427836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 66437836SJohn.Forte@Sun.COM #ifdef WIN32 66447836SJohn.Forte@Sun.COM PassFunc = (IMA_GetDiscoveryAddressOidListFn) 66457836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 66467836SJohn.Forte@Sun.COM "IMA_GetDiscoveryAddressOidList"); 66477836SJohn.Forte@Sun.COM #else 66487836SJohn.Forte@Sun.COM PassFunc = (IMA_GetDiscoveryAddressOidListFn) 66497836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 66507836SJohn.Forte@Sun.COM "IMA_GetDiscoveryAddressOidList"); 66517836SJohn.Forte@Sun.COM #endif 66527836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 66537836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 66547836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 66557836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 66567836SJohn.Forte@Sun.COM totalIdCount += 66577836SJohn.Forte@Sun.COM ppOidList->oidCount; 66587836SJohn.Forte@Sun.COM #ifdef WIN32 66597836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 66607836SJohn.Forte@Sun.COM GetProcAddress( 66617836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 66627836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 66637836SJohn.Forte@Sun.COM #else 66647836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 66657836SJohn.Forte@Sun.COM dlsym( 66667836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 66677836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 66687836SJohn.Forte@Sun.COM #endif 66697836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 66707836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 66717836SJohn.Forte@Sun.COM } 66727836SJohn.Forte@Sun.COM } 66737836SJohn.Forte@Sun.COM } 66747836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 66757836SJohn.Forte@Sun.COM } 66767836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 66777836SJohn.Forte@Sun.COM break; 66787836SJohn.Forte@Sun.COM } 66797836SJohn.Forte@Sun.COM } 66807836SJohn.Forte@Sun.COM } 66817836SJohn.Forte@Sun.COM 66827836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + 66837836SJohn.Forte@Sun.COM (totalIdCount - 1)* sizeof (IMA_OID)); 66847836SJohn.Forte@Sun.COM 66857836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 66867836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 66877836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 66887836SJohn.Forte@Sun.COM } 66897836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 66907836SJohn.Forte@Sun.COM 66917836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 66927836SJohn.Forte@Sun.COM totalIdCount = 0; 66937836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 66947836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 66957836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 66967836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 66977836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 66987836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 66997836SJohn.Forte@Sun.COM #ifdef WIN32 67007836SJohn.Forte@Sun.COM PassFunc = (IMA_GetDiscoveryAddressOidListFn) 67017836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 67027836SJohn.Forte@Sun.COM "IMA_GetDiscoveryAddressOidList"); 67037836SJohn.Forte@Sun.COM #else 67047836SJohn.Forte@Sun.COM PassFunc = (IMA_GetDiscoveryAddressOidListFn) 67057836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 67067836SJohn.Forte@Sun.COM "IMA_GetDiscoveryAddressOidList"); 67077836SJohn.Forte@Sun.COM #endif 67087836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 67097836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 67107836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 67117836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 67127836SJohn.Forte@Sun.COM for (j = 0; 67137836SJohn.Forte@Sun.COM (j < ppOidList->oidCount) && 67147836SJohn.Forte@Sun.COM (totalIdCount < 67157836SJohn.Forte@Sun.COM (*ppList)->oidCount); 67167836SJohn.Forte@Sun.COM j++) { 67177836SJohn.Forte@Sun.COM #define OBJ_SEQ_NUM ppOidList->oids[j].objectSequenceNumber 67187836SJohn.Forte@Sun.COM (*ppList)->oids 67197836SJohn.Forte@Sun.COM [totalIdCount]. 67207836SJohn.Forte@Sun.COM objectType = 67217836SJohn.Forte@Sun.COM ppOidList->oids[j]. 67227836SJohn.Forte@Sun.COM objectType; 67237836SJohn.Forte@Sun.COM (*ppList)->oids[ 67247836SJohn.Forte@Sun.COM totalIdCount]. 67257836SJohn.Forte@Sun.COM objectSequenceNumber 67267836SJohn.Forte@Sun.COM = OBJ_SEQ_NUM; 67277836SJohn.Forte@Sun.COM (*ppList)->oids[ 67287836SJohn.Forte@Sun.COM totalIdCount]. 67297836SJohn.Forte@Sun.COM ownerId = 67307836SJohn.Forte@Sun.COM ppOidList-> 67317836SJohn.Forte@Sun.COM oids[j].ownerId; 67327836SJohn.Forte@Sun.COM totalIdCount++; 67337836SJohn.Forte@Sun.COM #undef OBJ_SEQ_NUM 67347836SJohn.Forte@Sun.COM } 67357836SJohn.Forte@Sun.COM #ifdef WIN32 67367836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 67377836SJohn.Forte@Sun.COM GetProcAddress( 67387836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 67397836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 67407836SJohn.Forte@Sun.COM #else 67417836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 67427836SJohn.Forte@Sun.COM dlsym( 67437836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 67447836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 67457836SJohn.Forte@Sun.COM #endif 67467836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 67477836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 67487836SJohn.Forte@Sun.COM } 67497836SJohn.Forte@Sun.COM } 67507836SJohn.Forte@Sun.COM } 67517836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 67527836SJohn.Forte@Sun.COM } 67537836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 67547836SJohn.Forte@Sun.COM free(*ppList); 67557836SJohn.Forte@Sun.COM break; 67567836SJohn.Forte@Sun.COM } 67577836SJohn.Forte@Sun.COM } 67587836SJohn.Forte@Sun.COM } 67597836SJohn.Forte@Sun.COM 67607836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 67617836SJohn.Forte@Sun.COM return (status); 67627836SJohn.Forte@Sun.COM 67637836SJohn.Forte@Sun.COM } 67647836SJohn.Forte@Sun.COM 67657836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetSessionOidList( 67667836SJohn.Forte@Sun.COM IMA_OID Oid, 67677836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 67687836SJohn.Forte@Sun.COM 67697836SJohn.Forte@Sun.COM IMA_GetSessionOidListFn PassFunc; 67707836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 67717836SJohn.Forte@Sun.COM 67727836SJohn.Forte@Sun.COM IMA_UINT i; 67737836SJohn.Forte@Sun.COM IMA_UINT j; 67747836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 67757836SJohn.Forte@Sun.COM IMA_STATUS status; 67767836SJohn.Forte@Sun.COM 67777836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 67787836SJohn.Forte@Sun.COM InitLibrary(); 67797836SJohn.Forte@Sun.COM 67807836SJohn.Forte@Sun.COM if (ppList == NULL) 67817836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 67827836SJohn.Forte@Sun.COM 67837836SJohn.Forte@Sun.COM if ((Oid.objectType != IMA_OBJECT_TYPE_LHBA) && 67847836SJohn.Forte@Sun.COM (Oid.objectType != IMA_OBJECT_TYPE_TARGET)) { 67857836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 67867836SJohn.Forte@Sun.COM } 67877836SJohn.Forte@Sun.COM 67887836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 67897836SJohn.Forte@Sun.COM // Get total id count first 67907836SJohn.Forte@Sun.COM totalIdCount = 0; 67917836SJohn.Forte@Sun.COM 67927836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 67937836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 67947836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 67957836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 67967836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 67977836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 67987836SJohn.Forte@Sun.COM #ifdef WIN32 67997836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSessionOidListFn) 68007836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 68017836SJohn.Forte@Sun.COM "IMA_GetSessionOidList"); 68027836SJohn.Forte@Sun.COM #else 68037836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSessionOidListFn) 68047836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 68057836SJohn.Forte@Sun.COM "IMA_GetSessionOidList"); 68067836SJohn.Forte@Sun.COM #endif 68077836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 68087836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 68097836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 68107836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 68117836SJohn.Forte@Sun.COM totalIdCount += 68127836SJohn.Forte@Sun.COM ppOidList->oidCount; 68137836SJohn.Forte@Sun.COM #ifdef WIN32 68147836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 68157836SJohn.Forte@Sun.COM GetProcAddress( 68167836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 68177836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 68187836SJohn.Forte@Sun.COM #else 68197836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 68207836SJohn.Forte@Sun.COM dlsym( 68217836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 68227836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 68237836SJohn.Forte@Sun.COM #endif 68247836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 68257836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 68267836SJohn.Forte@Sun.COM } 68277836SJohn.Forte@Sun.COM } 68287836SJohn.Forte@Sun.COM 68297836SJohn.Forte@Sun.COM } 68307836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 68317836SJohn.Forte@Sun.COM } 68327836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 68337836SJohn.Forte@Sun.COM break; 68347836SJohn.Forte@Sun.COM } 68357836SJohn.Forte@Sun.COM } 68367836SJohn.Forte@Sun.COM } 68377836SJohn.Forte@Sun.COM 68387836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + 68397836SJohn.Forte@Sun.COM (totalIdCount - 1)* sizeof (IMA_OID)); 68407836SJohn.Forte@Sun.COM 68417836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 68427836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 68437836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 68447836SJohn.Forte@Sun.COM } 68457836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 68467836SJohn.Forte@Sun.COM 68477836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 68487836SJohn.Forte@Sun.COM totalIdCount = 0; 68497836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 68507836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 68517836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 68527836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 68537836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 68547836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 68557836SJohn.Forte@Sun.COM #ifdef WIN32 68567836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSessionOidListFn) 68577836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 68587836SJohn.Forte@Sun.COM "IMA_GetSessionOidList"); 68597836SJohn.Forte@Sun.COM #else 68607836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSessionOidListFn) 68617836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 68627836SJohn.Forte@Sun.COM "IMA_GetSessionOidList"); 68637836SJohn.Forte@Sun.COM #endif 68647836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 68657836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 68667836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 68677836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 68687836SJohn.Forte@Sun.COM for (j = 0; 68697836SJohn.Forte@Sun.COM (j < ppOidList->oidCount) && 68707836SJohn.Forte@Sun.COM (totalIdCount < 68717836SJohn.Forte@Sun.COM (*ppList)->oidCount); 68727836SJohn.Forte@Sun.COM j++) { 68737836SJohn.Forte@Sun.COM 68747836SJohn.Forte@Sun.COM #define OBJ_SEQ_NUM ppOidList->oids[j].objectSequenceNumber 68757836SJohn.Forte@Sun.COM (*ppList)->oids[ 68767836SJohn.Forte@Sun.COM totalIdCount]. 68777836SJohn.Forte@Sun.COM objectType = 68787836SJohn.Forte@Sun.COM ppOidList->oids[j]. 68797836SJohn.Forte@Sun.COM objectType; 68807836SJohn.Forte@Sun.COM (*ppList)->oids[ 68817836SJohn.Forte@Sun.COM totalIdCount]. 68827836SJohn.Forte@Sun.COM objectSequenceNumber 68837836SJohn.Forte@Sun.COM = OBJ_SEQ_NUM; 68847836SJohn.Forte@Sun.COM (*ppList)->oids[ 68857836SJohn.Forte@Sun.COM totalIdCount]. 68867836SJohn.Forte@Sun.COM ownerId = 68877836SJohn.Forte@Sun.COM ppOidList->oids[j]. 68887836SJohn.Forte@Sun.COM ownerId; 68897836SJohn.Forte@Sun.COM totalIdCount++; 68907836SJohn.Forte@Sun.COM #undef OBJ_SEQ_NUM 68917836SJohn.Forte@Sun.COM } 68927836SJohn.Forte@Sun.COM #ifdef WIN32 68937836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 68947836SJohn.Forte@Sun.COM GetProcAddress( 68957836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 68967836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 68977836SJohn.Forte@Sun.COM #else 68987836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 68997836SJohn.Forte@Sun.COM dlsym( 69007836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 69017836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 69027836SJohn.Forte@Sun.COM #endif 69037836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 69047836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 69057836SJohn.Forte@Sun.COM } 69067836SJohn.Forte@Sun.COM } 69077836SJohn.Forte@Sun.COM } 69087836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 69097836SJohn.Forte@Sun.COM } 69107836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 69117836SJohn.Forte@Sun.COM free(*ppList); 69127836SJohn.Forte@Sun.COM break; 69137836SJohn.Forte@Sun.COM } 69147836SJohn.Forte@Sun.COM } 69157836SJohn.Forte@Sun.COM } 69167836SJohn.Forte@Sun.COM 69177836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 69187836SJohn.Forte@Sun.COM return (status); 69197836SJohn.Forte@Sun.COM 69207836SJohn.Forte@Sun.COM } 69217836SJohn.Forte@Sun.COM 69227836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetConnectionOidList( 69237836SJohn.Forte@Sun.COM IMA_OID Oid, 69247836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 69257836SJohn.Forte@Sun.COM 69267836SJohn.Forte@Sun.COM IMA_GetSessionOidListFn PassFunc; 69277836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 69287836SJohn.Forte@Sun.COM 69297836SJohn.Forte@Sun.COM IMA_UINT i; 69307836SJohn.Forte@Sun.COM IMA_UINT j; 69317836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 69327836SJohn.Forte@Sun.COM IMA_STATUS status; 69337836SJohn.Forte@Sun.COM 69347836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 69357836SJohn.Forte@Sun.COM InitLibrary(); 69367836SJohn.Forte@Sun.COM 69377836SJohn.Forte@Sun.COM if (ppList == NULL) 69387836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 69397836SJohn.Forte@Sun.COM 69407836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_SESSION) { 69417836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 69427836SJohn.Forte@Sun.COM } 69437836SJohn.Forte@Sun.COM 69447836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 69457836SJohn.Forte@Sun.COM // Get total id count first 69467836SJohn.Forte@Sun.COM totalIdCount = 0; 69477836SJohn.Forte@Sun.COM 69487836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 69497836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 69507836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 69517836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 69527836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 69537836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 69547836SJohn.Forte@Sun.COM #ifdef WIN32 69557836SJohn.Forte@Sun.COM PassFunc = (IMA_GetConnectionOidListFn) 69567836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 69577836SJohn.Forte@Sun.COM "IMA_GetConnectionOidList"); 69587836SJohn.Forte@Sun.COM #else 69597836SJohn.Forte@Sun.COM PassFunc = (IMA_GetConnectionOidListFn) 69607836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 69617836SJohn.Forte@Sun.COM "IMA_GetConnectionOidList"); 69627836SJohn.Forte@Sun.COM #endif 69637836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 69647836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 69657836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 69667836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 69677836SJohn.Forte@Sun.COM totalIdCount += 69687836SJohn.Forte@Sun.COM ppOidList->oidCount; 69697836SJohn.Forte@Sun.COM #ifdef WIN32 69707836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 69717836SJohn.Forte@Sun.COM GetProcAddress( 69727836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 69737836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 69747836SJohn.Forte@Sun.COM #else 69757836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 69767836SJohn.Forte@Sun.COM dlsym( 69777836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 69787836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 69797836SJohn.Forte@Sun.COM #endif 69807836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 69817836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 69827836SJohn.Forte@Sun.COM } 69837836SJohn.Forte@Sun.COM } 69847836SJohn.Forte@Sun.COM 69857836SJohn.Forte@Sun.COM } 69867836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 69877836SJohn.Forte@Sun.COM } 69887836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 69897836SJohn.Forte@Sun.COM break; 69907836SJohn.Forte@Sun.COM } 69917836SJohn.Forte@Sun.COM } 69927836SJohn.Forte@Sun.COM } 69937836SJohn.Forte@Sun.COM 69947836SJohn.Forte@Sun.COM 69957836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) 69967836SJohn.Forte@Sun.COM + (totalIdCount - 1)* sizeof (IMA_OID)); 69977836SJohn.Forte@Sun.COM 69987836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 69997836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 70007836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 70017836SJohn.Forte@Sun.COM } 70027836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 70037836SJohn.Forte@Sun.COM 70047836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 70057836SJohn.Forte@Sun.COM totalIdCount = 0; 70067836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 70077836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 70087836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 70097836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 70107836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 70117836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 70127836SJohn.Forte@Sun.COM #ifdef WIN32 70137836SJohn.Forte@Sun.COM PassFunc = (IMA_GetConnectionOidListFn) 70147836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 70157836SJohn.Forte@Sun.COM "IMA_GetConnectionOidList"); 70167836SJohn.Forte@Sun.COM #else 70177836SJohn.Forte@Sun.COM PassFunc = (IMA_GetConnectionOidListFn) 70187836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 70197836SJohn.Forte@Sun.COM "IMA_GetConnectionOidList"); 70207836SJohn.Forte@Sun.COM #endif 70217836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 70227836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 70237836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 70247836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 70257836SJohn.Forte@Sun.COM for (j = 0; ( 70267836SJohn.Forte@Sun.COM j < ppOidList->oidCount) && 70277836SJohn.Forte@Sun.COM (totalIdCount < 70287836SJohn.Forte@Sun.COM (*ppList)->oidCount); 70297836SJohn.Forte@Sun.COM j++) { 70307836SJohn.Forte@Sun.COM #define OBJ_SEQ_NUM ppOidList->oids[j].objectSequenceNumber 70317836SJohn.Forte@Sun.COM (*ppList)-> 70327836SJohn.Forte@Sun.COM oids[totalIdCount]. 70337836SJohn.Forte@Sun.COM objectType = 70347836SJohn.Forte@Sun.COM ppOidList-> 70357836SJohn.Forte@Sun.COM oids[j].objectType; 70367836SJohn.Forte@Sun.COM (*ppList)-> 70377836SJohn.Forte@Sun.COM oids[totalIdCount]. 70387836SJohn.Forte@Sun.COM objectSequenceNumber 70397836SJohn.Forte@Sun.COM = OBJ_SEQ_NUM; 70407836SJohn.Forte@Sun.COM (*ppList)-> 70417836SJohn.Forte@Sun.COM oids[totalIdCount]. 70427836SJohn.Forte@Sun.COM ownerId = 70437836SJohn.Forte@Sun.COM ppOidList->oids[j]. 70447836SJohn.Forte@Sun.COM ownerId; 70457836SJohn.Forte@Sun.COM totalIdCount++; 70467836SJohn.Forte@Sun.COM #undef OBJ_SEQ_NUM 70477836SJohn.Forte@Sun.COM } 70487836SJohn.Forte@Sun.COM #ifdef WIN32 70497836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 70507836SJohn.Forte@Sun.COM GetProcAddress( 70517836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 70527836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 70537836SJohn.Forte@Sun.COM #else 70547836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 70557836SJohn.Forte@Sun.COM dlsym( 70567836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 70577836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 70587836SJohn.Forte@Sun.COM #endif 70597836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 70607836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 70617836SJohn.Forte@Sun.COM } 70627836SJohn.Forte@Sun.COM } 70637836SJohn.Forte@Sun.COM } 70647836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 70657836SJohn.Forte@Sun.COM } 70667836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 70677836SJohn.Forte@Sun.COM free(*ppList); 70687836SJohn.Forte@Sun.COM break; 70697836SJohn.Forte@Sun.COM } 70707836SJohn.Forte@Sun.COM } 70717836SJohn.Forte@Sun.COM } 70727836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 70737836SJohn.Forte@Sun.COM return (status); 70747836SJohn.Forte@Sun.COM 70757836SJohn.Forte@Sun.COM } 70767836SJohn.Forte@Sun.COM 70777836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_RemoveDiscoveryAddress( 70787836SJohn.Forte@Sun.COM IMA_OID discoveryAddressOid) { 70797836SJohn.Forte@Sun.COM 70807836SJohn.Forte@Sun.COM IMA_RemoveDiscoveryAddressFn PassFunc; 70817836SJohn.Forte@Sun.COM IMA_UINT i; 70827836SJohn.Forte@Sun.COM IMA_STATUS status; 70837836SJohn.Forte@Sun.COM 70847836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 70857836SJohn.Forte@Sun.COM InitLibrary(); 70867836SJohn.Forte@Sun.COM 70877836SJohn.Forte@Sun.COM if (discoveryAddressOid.objectType != 70887836SJohn.Forte@Sun.COM IMA_OBJECT_TYPE_DISCOVERY_ADDRESS) { 70897836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 70907836SJohn.Forte@Sun.COM } 70917836SJohn.Forte@Sun.COM 70927836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 70937836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 70947836SJohn.Forte@Sun.COM 70957836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 70967836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == discoveryAddressOid.ownerId) { 70977836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 70987836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 70997836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 71007836SJohn.Forte@Sun.COM #ifdef WIN32 71017836SJohn.Forte@Sun.COM PassFunc = (IMA_RemoveDiscoveryAddressFn) 71027836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 71037836SJohn.Forte@Sun.COM "IMA_RemoveDiscoveryAddress"); 71047836SJohn.Forte@Sun.COM #else 71057836SJohn.Forte@Sun.COM PassFunc = (IMA_RemoveDiscoveryAddressFn) 71067836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 71077836SJohn.Forte@Sun.COM "IMA_RemoveDiscoveryAddress"); 71087836SJohn.Forte@Sun.COM #endif 71097836SJohn.Forte@Sun.COM 71107836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 71117836SJohn.Forte@Sun.COM status = PassFunc(discoveryAddressOid); 71127836SJohn.Forte@Sun.COM } 71137836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 71147836SJohn.Forte@Sun.COM } 71157836SJohn.Forte@Sun.COM 71167836SJohn.Forte@Sun.COM break; 71177836SJohn.Forte@Sun.COM } 71187836SJohn.Forte@Sun.COM } 71197836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 71207836SJohn.Forte@Sun.COM return (status); 71217836SJohn.Forte@Sun.COM } 71227836SJohn.Forte@Sun.COM 71237836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetIpsecProperties( 71247836SJohn.Forte@Sun.COM IMA_OID oid, 71257836SJohn.Forte@Sun.COM IMA_IPSEC_PROPERTIES *pProps) { 71267836SJohn.Forte@Sun.COM IMA_GetIpsecPropertiesFn PassFunc; 71277836SJohn.Forte@Sun.COM IMA_UINT i; 71287836SJohn.Forte@Sun.COM IMA_STATUS status; 71297836SJohn.Forte@Sun.COM 71307836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 71317836SJohn.Forte@Sun.COM InitLibrary(); 71327836SJohn.Forte@Sun.COM 71337836SJohn.Forte@Sun.COM if (pProps == NULL) 71347836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 71357836SJohn.Forte@Sun.COM 71367836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PNP && 71377836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_LHBA) { 71387836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 71397836SJohn.Forte@Sun.COM } 71407836SJohn.Forte@Sun.COM 71417836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 71427836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 71437836SJohn.Forte@Sun.COM 71447836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 71457836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 71467836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 71477836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 71487836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 71497836SJohn.Forte@Sun.COM #ifdef WIN32 71507836SJohn.Forte@Sun.COM PassFunc = (IMA_GetIpsecPropertiesFn) 71517836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 71527836SJohn.Forte@Sun.COM "IMA_GetIpsecProperties"); 71537836SJohn.Forte@Sun.COM #else 71547836SJohn.Forte@Sun.COM PassFunc = (IMA_GetIpsecPropertiesFn) 71557836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 71567836SJohn.Forte@Sun.COM "IMA_GetIpsecProperties"); 71577836SJohn.Forte@Sun.COM #endif 71587836SJohn.Forte@Sun.COM 71597836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 71607836SJohn.Forte@Sun.COM status = PassFunc(oid, pProps); 71617836SJohn.Forte@Sun.COM } 71627836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 71637836SJohn.Forte@Sun.COM } 71647836SJohn.Forte@Sun.COM 71657836SJohn.Forte@Sun.COM break; 71667836SJohn.Forte@Sun.COM } 71677836SJohn.Forte@Sun.COM } 71687836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 71697836SJohn.Forte@Sun.COM return (status); 71707836SJohn.Forte@Sun.COM } 71717836SJohn.Forte@Sun.COM 71727836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetAddressKeys( 71737836SJohn.Forte@Sun.COM IMA_OID targetOid, 71747836SJohn.Forte@Sun.COM IMA_ADDRESS_KEYS **ppKeys) { 71757836SJohn.Forte@Sun.COM IMA_GetAddressKeysFn PassFunc; 71767836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 71777836SJohn.Forte@Sun.COM 71787836SJohn.Forte@Sun.COM IMA_STATUS status; 71797836SJohn.Forte@Sun.COM IMA_UINT i; 71807836SJohn.Forte@Sun.COM 71817836SJohn.Forte@Sun.COM 71827836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 71837836SJohn.Forte@Sun.COM InitLibrary(); 71847836SJohn.Forte@Sun.COM 71857836SJohn.Forte@Sun.COM if (ppKeys == NULL) 71867836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 71877836SJohn.Forte@Sun.COM 71887836SJohn.Forte@Sun.COM if (targetOid.objectType != IMA_OBJECT_TYPE_TARGET) 71897836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 71907836SJohn.Forte@Sun.COM 71917836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 71927836SJohn.Forte@Sun.COM 71937836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 71947836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 71957836SJohn.Forte@Sun.COM 71967836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == targetOid.ownerId) { 71977836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 71987836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 71997836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 72007836SJohn.Forte@Sun.COM #ifdef WIN32 72017836SJohn.Forte@Sun.COM PassFunc = 72027836SJohn.Forte@Sun.COM (IMA_GetAddressKeysFn) GetProcAddress( 72037836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 72047836SJohn.Forte@Sun.COM "IMA_GetAddressKeys"); 72057836SJohn.Forte@Sun.COM #else 72067836SJohn.Forte@Sun.COM PassFunc = (IMA_GetAddressKeysFn) dlsym( 72077836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 72087836SJohn.Forte@Sun.COM "IMA_GetAddressKeys"); 72097836SJohn.Forte@Sun.COM #endif 72107836SJohn.Forte@Sun.COM 72117836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 72127836SJohn.Forte@Sun.COM IMA_ADDRESS_KEYS *ppKeysList; 72137836SJohn.Forte@Sun.COM IMA_UINT addrSize; 72147836SJohn.Forte@Sun.COM addrSize = sizeof (IMA_ADDRESS_KEYS); 72157836SJohn.Forte@Sun.COM status = 72167836SJohn.Forte@Sun.COM PassFunc(targetOid, &ppKeysList); 72177836SJohn.Forte@Sun.COM if (IMA_SUCCESS(status)) { 72187836SJohn.Forte@Sun.COM 72197836SJohn.Forte@Sun.COM *ppKeys = 72207836SJohn.Forte@Sun.COM (IMA_ADDRESS_KEYS*)calloc(1, 72217836SJohn.Forte@Sun.COM addrSize + 72227836SJohn.Forte@Sun.COM (ppKeysList->addressKeyCount 72237836SJohn.Forte@Sun.COM - 1) * addrSize); 72247836SJohn.Forte@Sun.COM if ((*ppKeys) == NULL) { 72257836SJohn.Forte@Sun.COM status = EUOS_ERROR; 72267836SJohn.Forte@Sun.COM } else { 72277836SJohn.Forte@Sun.COM memcpy((*ppKeys), 72287836SJohn.Forte@Sun.COM ppKeysList, 72297836SJohn.Forte@Sun.COM addrSize + 72307836SJohn.Forte@Sun.COM (ppKeysList-> 72317836SJohn.Forte@Sun.COM addressKeyCount-1)* 72327836SJohn.Forte@Sun.COM addrSize); 72337836SJohn.Forte@Sun.COM 72347836SJohn.Forte@Sun.COM } 72357836SJohn.Forte@Sun.COM #ifdef WIN32 72367836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 72377836SJohn.Forte@Sun.COM GetProcAddress( 72387836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 72397836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 72407836SJohn.Forte@Sun.COM #else 72417836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 72427836SJohn.Forte@Sun.COM dlsym( 72437836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 72447836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 72457836SJohn.Forte@Sun.COM #endif 72467836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 72477836SJohn.Forte@Sun.COM FreeFunc(ppKeysList); 72487836SJohn.Forte@Sun.COM } 72497836SJohn.Forte@Sun.COM } 72507836SJohn.Forte@Sun.COM } 72517836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 72527836SJohn.Forte@Sun.COM } 72537836SJohn.Forte@Sun.COM 72547836SJohn.Forte@Sun.COM break; 72557836SJohn.Forte@Sun.COM } 72567836SJohn.Forte@Sun.COM } 72577836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 72587836SJohn.Forte@Sun.COM return (status); 72597836SJohn.Forte@Sun.COM } 72607836SJohn.Forte@Sun.COM 72617836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDiscoveryAddressProperties( 72627836SJohn.Forte@Sun.COM IMA_OID oid, 72637836SJohn.Forte@Sun.COM IMA_DISCOVERY_ADDRESS_PROPERTIES *pProps) { 72647836SJohn.Forte@Sun.COM 72657836SJohn.Forte@Sun.COM IMA_GetDiscoveryAddressPropertiesFn PassFunc; 72667836SJohn.Forte@Sun.COM IMA_UINT i; 72677836SJohn.Forte@Sun.COM IMA_STATUS status; 72687836SJohn.Forte@Sun.COM 72697836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 72707836SJohn.Forte@Sun.COM InitLibrary(); 72717836SJohn.Forte@Sun.COM 72727836SJohn.Forte@Sun.COM if (pProps == NULL) 72737836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 72747836SJohn.Forte@Sun.COM 72757836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_DISCOVERY_ADDRESS) 72767836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 72777836SJohn.Forte@Sun.COM 72787836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 72797836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 72807836SJohn.Forte@Sun.COM 72817836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 72827836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 72837836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 72847836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 72857836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 72867836SJohn.Forte@Sun.COM #ifdef WIN32 72877836SJohn.Forte@Sun.COM PassFunc = 72887836SJohn.Forte@Sun.COM (IMA_GetDiscoveryAddressPropertiesFn) 72897836SJohn.Forte@Sun.COM GetProcAddress( 72907836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 72917836SJohn.Forte@Sun.COM "IMA_GetDiscoveryAddressProperties"); 72927836SJohn.Forte@Sun.COM #else 72937836SJohn.Forte@Sun.COM PassFunc = 72947836SJohn.Forte@Sun.COM (IMA_GetDiscoveryAddressPropertiesFn) dlsym( 72957836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 72967836SJohn.Forte@Sun.COM "IMA_GetDiscoveryAddressProperties"); 72977836SJohn.Forte@Sun.COM #endif 72987836SJohn.Forte@Sun.COM 72997836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 73007836SJohn.Forte@Sun.COM status = PassFunc(oid, pProps); 73017836SJohn.Forte@Sun.COM } 73027836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 73037836SJohn.Forte@Sun.COM } 73047836SJohn.Forte@Sun.COM 73057836SJohn.Forte@Sun.COM break; 73067836SJohn.Forte@Sun.COM } 73077836SJohn.Forte@Sun.COM } 73087836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 73097836SJohn.Forte@Sun.COM return (status); 73107836SJohn.Forte@Sun.COM } 73117836SJohn.Forte@Sun.COM 73127836SJohn.Forte@Sun.COM IMA_API IMA_STATUS QIMA_SetUpdateInterval( 73137836SJohn.Forte@Sun.COM IMA_OID pluginOid, time_t interval) { 73147836SJohn.Forte@Sun.COM QIMA_SetUpdateIntervalFn updFunc; 73157836SJohn.Forte@Sun.COM IMA_UINT i; 73167836SJohn.Forte@Sun.COM IMA_STATUS status; 73177836SJohn.Forte@Sun.COM 73187836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 73197836SJohn.Forte@Sun.COM InitLibrary(); 73207836SJohn.Forte@Sun.COM 73217836SJohn.Forte@Sun.COM if (interval <= 1) 73227836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 73237836SJohn.Forte@Sun.COM 73247836SJohn.Forte@Sun.COM if ((pluginOid.objectType != IMA_OBJECT_TYPE_PLUGIN) || 73257836SJohn.Forte@Sun.COM (pluginOid.objectSequenceNumber != 0)) 73267836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 73277836SJohn.Forte@Sun.COM 73287836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 73297836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 73307836SJohn.Forte@Sun.COM 73317836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 73327836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == pluginOid.ownerId) { 73337836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 73347836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 73357836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 73367836SJohn.Forte@Sun.COM #ifdef WIN32 73377836SJohn.Forte@Sun.COM updFunc = (QIMA_SetUpdateIntervalFn) 73387836SJohn.Forte@Sun.COM GetProcAddress( 73397836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 73407836SJohn.Forte@Sun.COM "QIMA_SetUpdateInterval"); 73417836SJohn.Forte@Sun.COM #else 73427836SJohn.Forte@Sun.COM updFunc = (QIMA_SetUpdateIntervalFn) dlsym( 73437836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 73447836SJohn.Forte@Sun.COM "QIMA_SetUpdateInterval"); 73457836SJohn.Forte@Sun.COM #endif 73467836SJohn.Forte@Sun.COM 73477836SJohn.Forte@Sun.COM if (updFunc != NULL) { 73487836SJohn.Forte@Sun.COM status = updFunc(pluginOid, interval); 73497836SJohn.Forte@Sun.COM } 73507836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 73517836SJohn.Forte@Sun.COM } 73527836SJohn.Forte@Sun.COM 73537836SJohn.Forte@Sun.COM break; 73547836SJohn.Forte@Sun.COM } 73557836SJohn.Forte@Sun.COM } 73567836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 73577836SJohn.Forte@Sun.COM return (status); 73587836SJohn.Forte@Sun.COM 73597836SJohn.Forte@Sun.COM } 7360