fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Description
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ImaLib.c - Implements a sample common IMA library
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * License:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the SNIA Public License
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Version 1.0(the "License"); you may not use this file except in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * compliance with the License. You may obtain a copy of the License at
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /http://www.snia.org/English/Resources/Code/OpenSource.html
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Software distributed under the License is distributed on an "AS IS"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the License for the specific language governing rights and limitations
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The Original Code is SNIA HBA API and IMA general header file
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The Initial Developer of the Original Code is:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Benjamin F. Kuo, Troika Networks, Inc. (benk@troikanetworks.com)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * David Dillard VERITAS Software david.dillard@veritas.com
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Contributor(s):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Jeff Ding, Adaptec, Inc. (jding@corp.adaptec.com)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Changes:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 09/24/2003 Initial Draft
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (for other changes... see the CVS logs)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 12/15/2003 corrected the defined parameter in IMA_SetPhbaIsnsDiscovery().
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lower case the computer name as iscsi name in IMA_GenerateNodeName().
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 01/21/2005 Updated to support IMA 1.1.3.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <windows.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/sem.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <dlfcn.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdarg.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <string.h>
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden#include <strings.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdlib.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte// #include <sys/sem.h>
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden#include <unistd.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <time.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdio.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte// #include <sys/ipc.h>
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden#include <netdb.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China#include "libsun_ima.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "ima.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "ima-plugin.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LIBRARY_PROPERTY_SUPPORTED_IMA_VERSION 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LIBRARY_PROPERTY_IMPLEMENTATION_VERSION L"1.0.2"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LIBRARY_PROPERTY_VENDOR L"QLogic, Inc."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DEFAULT_NODE_NAME_FORMAT "iqn.1986-03.com.sun.central.%s"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Linux only */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LIBRARY_FILE_NAME L"libima.so"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define EUOS_ERROR IMA_ERROR_UNEXPECTED_OS_ERROR
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing ChinaIMA_PLUGIN_INFO plugintable[IMA_MAX_NUM_PLUGINS];
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing Chinaint number_of_plugins = -1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic IMA_NODE_NAME sharedNodeName;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic IMA_NODE_ALIAS sharedNodeAlias;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic HANDLE libMutex = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing Chinaint libMutex = -1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid ExitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void libSwprintf(wchar_t *wcs, const wchar_t *lpszFormat, ...) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte va_list args;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte va_start(args, lpszFormat);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vswprintf(wcs, lpszFormat, args);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vswprintf(wcs, 255, lpszFormat, args);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte va_end(args);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Begin implementation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteBOOL APIENTRY DllMain(HANDLE hModule,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DWORD ul_reason_for_call,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LPVOID lpReserved) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (ul_reason_for_call) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DLL_PROCESS_ATTACH:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DLL_PROCESS_DETACH:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ExitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DLL_THREAD_ATTACH:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DLL_THREAD_DETACH:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (TRUE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#elif defined(SOLARIS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid so_init(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid so_fini(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int os_createmutex(int *semid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void os_obtainmutex(int semid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void os_releasemutex(int semid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void os_destroymutex(int semid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic IMA_STATUS getSolarisNodeProps(IMA_NODE_PROPERTIES *nodeProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic IMA_STATUS getSolarisSharedNodeName(IMA_NODE_NAME name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic IMA_STATUS getSolarisSharedNodeAlias(IMA_NODE_ALIAS alias);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic IMA_STATUS setSolarisSharedNodeName(const IMA_NODE_NAME name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic IMA_STATUS setSolarisSharedNodeAlias(const IMA_NODE_ALIAS alias);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#pragma init(so_init)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#pragma fini(so_fini)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid so_init() {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid so_fini() {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ExitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic IMA_STATUS getSolarisNodeProps(IMA_NODE_PROPERTIES *nodeProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ret;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetNodePropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID nodeOid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(plugintable[i].PluginPath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "libsun_ima.so") == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetNodePropertiesFn) dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNodeProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(nodeOid, nodeProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic IMA_STATUS getSolarisSharedNodeName(IMA_NODE_NAME name) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_NODE_PROPERTIES nodeProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = getSolarisNodeProps(&nodeProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(&nodeProps.name, name, sizeof (IMA_NODE_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic IMA_STATUS getSolarisSharedNodeAlias(IMA_NODE_ALIAS alias) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_NODE_PROPERTIES nodeProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = getSolarisNodeProps(&nodeProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(&nodeProps.alias, alias, sizeof (IMA_NODE_ALIAS));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic IMA_STATUS setSolarisSharedNodeName(const IMA_NODE_NAME name) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ret;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_NODE_PROPERTIES nodeProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetNodeNameFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID nodeOid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(plugintable[i].PluginPath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "libsun_ima.so") == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetNodeNameFn) dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetNodeName");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(nodeOid, name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic IMA_STATUS setSolarisSharedNodeAlias(const IMA_NODE_ALIAS alias) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ret;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_NODE_PROPERTIES nodeProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetNodeAliasFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID nodeOid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(plugintable[i].PluginPath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "libsun_ima.so") == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetNodeAliasFn) dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetNodeAlias");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(nodeOid, alias);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * add code in .init and .fini,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * "__attribute__ ((constructor))" and "__attribute__ ((destructor))"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * are used with gcc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden__attribute__((constructor)) void init() {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden__attribute__((destructor)) void fini() {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ExitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic BOOL os_createmutex(HANDLE Mutex) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Mutex = CreateMutex(NULL, FALSE, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Mutex == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (TRUE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void os_destroymutex(HANDLE Mutex) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Mutex != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte CloseHandle(Mutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void os_obtainmutex(HANDLE Mutex) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte WaitForSingleObject(Mutex, INFINITE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void os_releasemutex(HANDLE Mutex) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ReleaseMutex(Mutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* <sys/sem.h> */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteunion semun {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int val; /* value for SETVAL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct semid_ds *bf; /* buffer for IPC_STAT, IPC_SET */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned short int *array; /* array for GETALL, SETALL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct seminfo *__buf; /* buffer for IPC_INFO */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Create the semaphore. Return 1 if successful, 0 otherwise */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int os_createmutex(int *semid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int retVal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte union semun sem_union;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (semid == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retVal = semget(IPC_PRIVATE, 1, IPC_CREAT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (retVal == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *semid = retVal; /* save key of created semaphore */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sem_union.val = 1; /* start semaphore off signaled */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retVal = semctl(*semid, 0, SETVAL, sem_union);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (retVal == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void os_obtainmutex(int semid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int retVal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct sembuf sem_b;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sem_b.sem_num = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sem_b.sem_op = -1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sem_b.sem_flg = SEM_UNDO;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retVal = semop(semid, &sem_b, 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void os_releasemutex(int semid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int retVal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct sembuf sem_b;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sem_b.sem_num = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sem_b.sem_op = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sem_b.sem_flg = SEM_UNDO;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retVal = semop(semid, &sem_b, 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Destroy the SNMP semaphore. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void os_destroymutex(int semid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int retVal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte union semun sem_union;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retVal = semctl(semid, 0, IPC_RMID, sem_union);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid InitLibrary() {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FILE *imaconf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fullline[512]; /* Full line read in from IMA.conf */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char pluginname[64]; /* Read in from file IMA.conf */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char pluginpath[256]; /* Read in from file IMA.conf */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char imaConfFilePath[256];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char systemPath[256];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *charPtr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT dwStrLength;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins != -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte number_of_plugins = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (os_createmutex(&libMutex) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sharedNodeAlias[0] = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dwStrLength = 255;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Open configuration file from known location */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (GetSystemDirectory(systemPath, sizeof (systemPath)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sprintf(imaConfFilePath, "%s\\drivers\\etc\\ima.conf",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte systemPath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strcpy(imaConfFilePath, "ima.conf");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strcpy(imaConfFilePath, "/etc/ima.conf");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((imaconf = fopen(imaConfFilePath, "r")) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Read in each line and load library */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((imaconf != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (fgets(fullline, sizeof (fullline), imaconf))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fullline[0] != '#') && (fullline[0] != '\n')) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Take out the '\n' */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((charPtr = (char *)strchr(fullline, '\n')) != NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *charPtr = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* look for the first tab */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((charPtr = (char *)strchr(fullline, '\t')) == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte charPtr = (char *)strchr(fullline, ' ');
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set Null termination for library name if found */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (charPtr != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *charPtr++ = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Skip spaces and tabs until
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the next character found
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((*charPtr == ' ') || (*charPtr == '\t'))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte charPtr++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue; /* May be invalid entry */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy library name and path */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strcpy(pluginname, fullline);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strcpy(pluginpath, charPtr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Continue to the next line if library name or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * path is invalid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strlen(pluginname) == 0) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strlen(pluginpath) == 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load the DLL now */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin = LoadLibrary(pluginpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load the DLL now */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin = dlopen(pluginpath, RTLD_LAZY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typedef int (*InitializeFn)();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitializeFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcpy((char *)&plugintable[i].PluginName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (char *)&pluginname, 64);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcpy((char *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &plugintable[i].PluginPath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (char *)&pluginpath, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].ownerId = i + 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (InitializeFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin, "Initialize");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (InitializeFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin, "Initialize");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc(plugintable[i].ownerId);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].number_of_vbcallbacks = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].number_of_pccallbacks = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_createmutex(&(plugintable[i].pluginMutex));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte number_of_plugins = i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid ExitLibrary() {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TerminateFn ExitPassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < plugintable[i].number_of_vbcallbacks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IMA_DFOBC_STR "IMA_DeregisterForObjectVisibilityChangesFn"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_DeregisterForObjectVisibilityChangesFn
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_DeregisterForObjectVisibilityChangesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_DFOBC_STR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_DeregisterForObjectVisibilityChangesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_DFOBC_STR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc(plugintable[i].vbcallback[j]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#undef IMA_DFOBC_STR
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].number_of_vbcallbacks = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < plugintable[i].number_of_pccallbacks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_DeregisterForObjectPropertyChangesFn
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_DeregisterForObjectPropertyChangesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_DeregisterForObjectPropertyChangesFn");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_DeregisterForObjectPropertyChangesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_DeregisterForObjectPropertyChangesFn");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc(plugintable[i].pccallback[j]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].number_of_pccallbacks = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ExitPassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (TerminateFn) GetProcAddress
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (plugintable[i].hPlugin, "Terminate");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ExitPassFunc = (TerminateFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin, "Terminate");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ExitPassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ExitPassFunc();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Unload DLL from memory */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeLibrary(plugintable[i].hPlugin);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Unload DLL from memory */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlclose(plugintable[i].hPlugin);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_destroymutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte number_of_plugins = -1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_destroymutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void VisibilityCallback(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL becomingVisible,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID objectId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i, j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((plugintable[i].hPlugin != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (objectId.ownerId == plugintable[i].ownerId)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j < plugintable[i].number_of_vbcallbacks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (plugintable[i].vbcallback[j])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (becomingVisible, objectId);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void PropertyCallback(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID objectId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i, j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((plugintable[i].hPlugin != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (objectId.ownerId == plugintable[i].ownerId)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j < plugintable[i].number_of_pccallbacks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (plugintable[i].pccallback[j])(objectId);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the date and time, in the form of an IMA_DATETIME, from the build
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * script when compiled.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void GetBuildTime(IMA_DATETIME* pdatetime) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *dayToken[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *monthToken[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char monthString[4];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char dayString[4];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sscanf(__TIME__, "%u:%u:%u", &pdatetime->tm_hour,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pdatetime->tm_min, &pdatetime->tm_sec);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sscanf(__DATE__, "%s %u %u", monthString,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pdatetime->tm_mday, &pdatetime->tm_year);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sscanf(__TIMESTAMP__, "%s", dayString);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pdatetime->tm_year -= 1900;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pdatetime->tm_isdst = -1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pdatetime->tm_wday = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < 7; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(dayToken[i], dayString) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pdatetime->tm_wday = i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pdatetime->tm_mon = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < 12; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(monthToken[i], monthString) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pdatetime->tm_mon = i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(BUILD_DATE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strptime(BUILD_DATE, "%Y/%m/%d %T %Z", pdatetime) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(pdatetime, 0, sizeof (IMA_DATETIME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(pdatetime, 0, sizeof (IMA_DATETIME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the properties of the IMA library that is being used.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param pProps A pointer to an @ref IMA_LIBRARY_PROPERTIES structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * allocated by the caller. On successful return this structure will
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * contain the properties of the IMA library.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation was successful or if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the library properties were successfully
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * returned.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specifies a memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetLibraryProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_LIBRARY_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char imaPath[256];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HMODULE imaHandle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // Fill in the library properties.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetBuildTime(&pProps->buildTime);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pProps->supportedImaVersion = LIBRARY_PROPERTY_SUPPORTED_IMA_VERSION;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte libSwprintf(pProps->implementationVersion, L"%ls",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LIBRARY_PROPERTY_IMPLEMENTATION_VERSION);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte libSwprintf(pProps->vendor, L"%ls", LIBRARY_PROPERTY_VENDOR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte imaHandle = GetModuleHandleA("ima");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte imaPath[0] = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (imaHandle != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetModuleFileNameA(imaHandle, imaPath, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MultiByteToWideChar(CP_ACP, 0, imaPath, -1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pProps->fileName, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte libSwprintf(pProps->fileName, LIBRARY_FILE_NAME);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // mbstowcs(pProps->fileName, imaPath, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_STATUS_SUCCESS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets a list of the object IDs of all currently loaded plugins.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param ppList A pointer to a pointer to an @ref IMA_OID_LIST.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * On successful return this will contain a pointer to an @ref
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IMA_OID_LIST which contains the object IDs of all of the plugins
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * currently loaded by the library.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation was successful
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or if an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the plugin ID list was successfully
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * returned.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specifies a memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetPluginOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (number_of_plugins - 1) * sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppList) == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_UNEXPECTED_OS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount = number_of_plugins;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[i].objectType = IMA_OBJECT_TYPE_PLUGIN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[i].ownerId = plugintable[i].ownerId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[i].objectSequenceNumber = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_STATUS_SUCCESS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the properties of the specified vendor plugin.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param pluginId The ID of the plugin whose properties are being retrieved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param pProps A pointer to an @ref IMA_PLUGIN_PROPERTIES structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * allocated by the caller. On successful return this will contain the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * properties of the plugin specified by pluginId.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation was successful or if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the plugin properties were successfully
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * returned.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a pluginId does not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify any valid object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a pluginId does not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify a plugin object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a pluginId refers to a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * plugin, but not one that is currently loaded.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify a memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetPluginProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID pluginOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_PLUGIN_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetPluginPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((pluginOid.objectType != IMA_OBJECT_TYPE_PLUGIN) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pluginOid.objectSequenceNumber != 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == pluginOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPluginPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPluginProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPluginPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPluginProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(pluginOid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the object ID for the plugin associated with the specified object ID.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param objectId The object ID of an object that has been received from
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * a previous library call.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param pPluginId A pointer to an @ref IMA_OID structure allocated by the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caller. On successful return this will contain the object ID of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * plugin associated with the object specified by @a objectId. This
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * can then be used to work with the plugin, e.g., to get the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * properties of the plugin or the send the plugin an IOCtl.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation was successful or if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the associated plugin ID was
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * successfully returned.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pPluginId is NULL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or specifes a memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a objectId specifies
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an object not owned by a plugin, but instead one that is owned by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the library.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a objectId specifies
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an object with an invalid type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetAssociatedPluginOid(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID objectId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID *pPluginId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pPluginId == NULL || objectId.ownerId == RL_LIBRARY_SEQNUM)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (objectId.objectType != IMA_OBJECT_TYPE_UNKNOWN &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectId.objectType != IMA_OBJECT_TYPE_PLUGIN &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectId.objectType != IMA_OBJECT_TYPE_NODE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectId.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectId.objectType != IMA_OBJECT_TYPE_PHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectId.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectId.objectType != IMA_OBJECT_TYPE_PORTAL_GROUP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectId.objectType != IMA_OBJECT_TYPE_LNP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectId.objectType != IMA_OBJECT_TYPE_PNP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectId.objectType != IMA_OBJECT_TYPE_TARGET &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectId.objectType != IMA_OBJECT_TYPE_LU &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectId.objectType != IMA_OBJECT_TYPE_DISCOVERY_ADDRESS &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectId.objectType != IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (objectId.ownerId == plugintable[i].ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pPluginId->objectType = IMA_OBJECT_TYPE_PLUGIN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pPluginId->ownerId = plugintable[i].ownerId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pPluginId->objectSequenceNumber = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the object ID of the shared node.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param pSharedNodeId A pointer to an @ref IMA_OID structure allocated by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the caller. On successful return it will contain the object ID of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * shared node of the currently executing system is placed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation was successful or if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the shared node ID has been successfully
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * retrieved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pSharedNodeId is NULL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or specifies a memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetSharedNodeOid(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID *pSharedNodeId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pSharedNodeId == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pSharedNodeId->objectType = IMA_OBJECT_TYPE_NODE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pSharedNodeId->ownerId = RL_LIBRARY_SEQNUM;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pSharedNodeId->objectSequenceNumber = RL_SHARED_NODE_SEQNUM;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_STATUS_SUCCESS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetObjectType(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OBJECT_TYPE *pObjectType) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pObjectType == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_UNKNOWN &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_PLUGIN &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_NODE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_PHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_PORTAL_GROUP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_LNP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_PNP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_TARGET &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_LU &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_DISCOVERY_ADDRESS &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *pObjectType = oid.objectType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the properties of the specified iSCSI node.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param nodeId The ID of the node to get the properties of.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param pProps A pointer to an @ref IMA_NODE_PROPERTIES structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * which on successfully return
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * will contain the properties of the specified node.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation was successful or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the node properties have been
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * successfully retrieved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or specifies a memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a nodeId does
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * not specify any valid object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a nodeId does
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * not specify a node object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a nodeId does not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify a node which is currently known to the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetNodeProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID nodeOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_NODE_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetNodePropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fullline[512]; /* Full line read in from IMA.conf */
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden char nodename[MAXHOSTNAMELEN];
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden#if defined(_WINDOWS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT dwStrLength;
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (nodeOid.objectType != IMA_OBJECT_TYPE_NODE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((nodeOid.ownerId == RL_LIBRARY_SEQNUM) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (nodeOid.objectSequenceNumber == RL_SHARED_NODE_SEQNUM)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pProps->runningInInitiatorMode = IMA_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pProps->runningInTargetMode = IMA_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pProps->nameAndAliasSettable = IMA_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sharedNodeName[0] == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_WINDOWS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetComputerName((char *)fullline,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LPDWORD)&dwStrLength);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sprintf(nodename, DEFAULT_NODE_NAME_FORMAT, fullline);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MultiByteToWideChar(CP_ACP, 0, nodename, -1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sharedNodeName, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#elif defined(SOLARIS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (getSolarisSharedNodeName(sharedNodeName) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS_SUCCESS) {
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden gethostname((char *)fullline,
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden sizeof (fullline));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sprintf(nodename,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEFAULT_NODE_NAME_FORMAT, fullline);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mbstowcs(sharedNodeName, nodename, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden gethostname((char *)fullline, sizeof (fullline));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sprintf(nodename, DEFAULT_NODE_NAME_FORMAT, fullline);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mbstowcs(sharedNodeName, nodename, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sharedNodeName[0] != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte libSwprintf(pProps->name, L"%ls", sharedNodeName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pProps->nameValid = IMA_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pProps->nameValid = IMA_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(SOLARIS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sharedNodeAlias[0] == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getSolarisSharedNodeAlias(sharedNodeAlias);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sharedNodeAlias[0] != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte libSwprintf(pProps->alias, L"%ls", sharedNodeAlias);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pProps->aliasValid = IMA_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pProps->aliasValid = IMA_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_STATUS_SUCCESS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == nodeOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetNodePropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNodeProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetNodePropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNodeProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(nodeOid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Sets the name of the specified node.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param nodeId The object ID of the node whose name is being set.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param newName The new name of the node.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation was successful or if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the node name was successfully changed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_STATUS_REBOOT_NECESSARY Returned if a reboot is necessary
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * before the setting of the name actually takes affect.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a newname is NULL, or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specifies a memory area to which data cannot be written, or has a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * length of 0.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a nodeId does not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify any valid object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a nodeId does not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify a node object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a nodeId does not specify a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * node which is currently known to the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_NAME_TOO_LONG Returned if @a newName contains too many
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * characters.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetNodeName(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID nodeOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_NODE_NAME newName) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetNodeNameFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (newName == NULL || wcslen(newName) == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wcslen(newName) > IMA_NODE_NAME_LEN - 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_NAME_TOO_LONG);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (nodeOid.objectType != IMA_OBJECT_TYPE_NODE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((nodeOid.ownerId == RL_LIBRARY_SEQNUM) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (nodeOid.objectSequenceNumber == RL_SHARED_NODE_SEQNUM)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(SOLARIS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (setSolarisSharedNodeName(newName) != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_UNKNOWN_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte libSwprintf(sharedNodeName, L"%ls", newName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_STATUS_SUCCESS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == nodeOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetNodeNameFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetNodeName");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetNodeNameFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetNodeName");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(nodeOid, newName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Generates an unique node name for the currently running system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param generatedname On successful return contains the generated node
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * name.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation was successful or if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a generatedname is NULL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or specifies a memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GenerateNodeName(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_NODE_NAME generatedname) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char computername[256];
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden char nodename[MAXHOSTNAMELEN];
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden#if defined(_WINDOWS)
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden IMA_UINT dwStrLength = 255;
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden#endif
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _WINDOWS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef SOLARIS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (generatedname == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_WINDOWS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetComputerName((char *)computername, (LPDWORD)&dwStrLength);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _strlwr(computername);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _snprintf(nodename, 256, DEFAULT_NODE_NAME_FORMAT, computername);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MultiByteToWideChar(CP_ACP, 0, nodename, -1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte generatedname, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#elif defined(SOLARIS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (getSolarisSharedNodeName(generatedname) != IMA_STATUS_SUCCESS) {
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden gethostname(computername, sizeof (computername));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sprintf(nodename, DEFAULT_NODE_NAME_FORMAT, generatedname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mbstowcs(generatedname, nodename, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
5d539a8e4ead06ddda1d7f0274efee3d06c20e22Matt Barden gethostname((char *)computername, sizeof (computername));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (computername[i] != '\0') {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte computername[i] = tolower(computername[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte snprintf(nodename, 256, DEFAULT_NODE_NAME_FORMAT, computername);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mbstowcs(generatedname, nodename, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_STATUS_SUCCESS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Sets the alias of the specified node.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param nodeId The object ID of the node whose alias is being set.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param newAlias A pointer to a Unicode string which contains the new node
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * alias.If this parameter is NULL then the current alias is deleted, in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * which case the specified node no longer has an alias.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation was successful or if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the node's alias has been successfully set.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_STATUS_REBOOT_NECESSARY A reboot is necessary before
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the setting of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * alias actually takes affect.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a nodeId does not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify any valid object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a nodeId does not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify a node object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a nodeId does not specify
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * a node which is currently known to the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_NAME_TOO_LONG Returned if @a newAlias contains too many
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * characters.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetNodeAlias(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID nodeOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_NODE_ALIAS newAlias) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetNodeAliasFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (newAlias == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wcslen(newAlias) > IMA_NODE_ALIAS_LEN - 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_NAME_TOO_LONG);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (nodeOid.objectType != IMA_OBJECT_TYPE_NODE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((nodeOid.ownerId == RL_LIBRARY_SEQNUM) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (nodeOid.objectSequenceNumber == RL_SHARED_NODE_SEQNUM)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(SOLARIS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (setSolarisSharedNodeAlias(newAlias) != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_UNKNOWN_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wcslen(newAlias) > 0 && newAlias != NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte libSwprintf(sharedNodeAlias, L"%ls", newAlias);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte libSwprintf(sharedNodeAlias, L"%ls", "");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_STATUS_SUCCESS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == nodeOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetNodeAliasFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetNodeAlias");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetNodeAliasFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetNodeAlias");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(nodeOid, newAlias);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets a list of the object IDs of all the logical HBAs in the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param ppList A pointer to a pointer to an @ref IMA_OID_LIST structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * on successful return this will contain a pointer to an
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @ref IMA_OID_LIST which contains the object IDs of all of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * LHBAs currently in the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation was successful or if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the LHBA ID list has been successfully
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * returned.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specifies a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetLhbaOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetLhbaOidListFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // Get total id count first
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLhbaOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLhbaOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLhbaOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLhbaOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(&ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount += ppOidList->oidCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (totalIdCount - 1) * sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppList) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_UNEXPECTED_OS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount = totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // 2nd pass to copy the id lists
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLhbaOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLhbaOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLhbaOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLhbaOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(&ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (j < ppOidList->oidCount) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (totalIdCount <
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectType
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte = ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectSequenceNumber =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectSequenceNumber;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ownerId =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].ownerId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(*ppList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the properties of the specified logical HBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param lhbaId The object ID of the LHBA whose properties are being
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * retrieved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param pProps A pointer to an @ref IMA_LHBA_PROPERTIES structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * On successful
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return this will contain the properties of the LHBA specified by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @a lhbaId.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation was successful or if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the properties of the specified LHBA
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * have been successfully retrieved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify a memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a lhbaId does not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify any valid object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a lhbaId does not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify a LHBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a lhbaId does not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify a LHBA which is currently known to the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetLhbaProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_LHBA_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetLhbaPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLhbaPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLhbaProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLhbaPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLhbaProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(lhbaId, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets a list of the object IDs of all the physical HBAs in the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param ppList A pointer to a pointer to an @ref IMA_OID_LIST structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * on successful return this will contain a pointer to an
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @ref IMA_OID_LIST which contains the object IDs of all of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PHBAs currently in the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation was successful or if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the PHBA ID list has been successfully
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * returned.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify a memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the properties of the specified PHBA
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * have been successfully retrieved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a phbaId does not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify a PHBA which is currently known to the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specify a memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetPhbaOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetPhbaOidListFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // Get total id count first
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPhbaOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPhbaOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPhbaOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPhbaOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(&ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount += ppOidList->oidCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (totalIdCount - 1) * sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppList) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_UNEXPECTED_OS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount = totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // 2nd pass to copy the id lists
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPhbaOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPhbaOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPhbaOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPhbaOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(&ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (j < ppOidList->oidCount) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (totalIdCount <
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectType =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectSequenceNumber =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectSequenceNumber;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ownerId =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].ownerId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(*ppList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the general properties of a physical HBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param phbaId The object ID of the PHBA whose
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * properties are being queried.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param pProps A pointer to an @ref
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IMA_PHBA_PROPERTIES structure. On successful
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return this will contain the properties of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the PHBA specified by @a phbaId.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operation was successful or if an error
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the properties
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of the specified PHBA have been
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * successfully retrieved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if @a pProps is NULL or specifies a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if @a phbaId does not specify any
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * valid object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if @a phbaId does not specify a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PHBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if @a phbaId does not specify a PHBA
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * which is currently known to the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetPhbaProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID phbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_PHBA_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetPhbaPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == phbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPhbaPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPhbaProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPhbaPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPhbaProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(phbaId, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Frees a previously allocated IMA_OID_LIST structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param pList A pointer to an @ref IMA_OID_LIST
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * structure allocated by the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * library. On successful return the memory
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * allocated by the list is freed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * was successful or if an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the specified object
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ID list was successfully freed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if @a pList is NULL or specifies a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * memory area from which data cannot be read.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_FreeMemory(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *pMemory) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pMemory == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(pMemory);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_STATUS_SUCCESS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetNonSharedNodeOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetNonSharedNodeOidListFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // Get total id count first
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetNonSharedNodeOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNonSharedNodeOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetNonSharedNodeOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNonSharedNodeOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(&ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount += ppOidList->oidCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (totalIdCount - 1) * sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppList) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_UNEXPECTED_OS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount = totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // 2nd pass to copy the id lists
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetNonSharedNodeOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNonSharedNodeOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetNonSharedNodeOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNonSharedNodeOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(&ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (j < ppOidList->oidCount) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (totalIdCount < (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList)->oidCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount].objectType =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectSequenceNumber =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectSequenceNumber;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ownerId =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ownerId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(*ppList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the first burst length properties of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the specified logical HBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param lhbaId The object ID of the logical HBA
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to get the first burst length
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * properties of.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param pProps A pointer to a min/max values
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * was successful or if an error
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the first burst
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * length properties have been
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * successfully retrieved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if @a pProps is NULL or specifies a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if @a lhbaId does not specify any
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * valid object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if @a lhbaId does not specify a LHBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @a lhbaId does not specify a LHBA
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * which is currently known to the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetFirstBurstLengthProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_MIN_MAX_VALUE *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetFirstBurstLengthPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetFirstBurstLengthPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetFirstBurstLengthProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetFirstBurstLengthPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetFirstBurstLengthProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the max burst length properties of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specified logical HBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param lhbaId The object ID of the logical HBA to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get the max burst length properties of.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param pProps A pointer to an @ref IMA_MIN_MAX_VALUE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * structure allocated by the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caller. On successful return this structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * will contain the max
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * burst length properties of this LHBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * was successful or if an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the max burst
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * length properties have been
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * successfully retrieved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if @a pProps is NULL or specifies a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if @a lhbaId does not specify any
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * valid object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if @a lhbaId does not specify a HBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if @a lhbaId does not specify a LHBA
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * which is currently known to the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetMaxBurstLengthProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_MIN_MAX_VALUE *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetMaxBurstLengthPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetMaxBurstLengthPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetMaxBurstLengthProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetMaxBurstLengthPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetMaxBurstLengthProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the maximum receive data segment length properties
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of the specified logical HBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param lhbaId The object ID of the logical HBA to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get the max receive data
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * segment length properties of.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @param pProps A pointer to an @ref IMA_MIN_MAX_VALUE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * structure allocated by the caller.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * On successful return this structure will contain the max
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * receive data segment length properties of this LHBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @return An IMA_STATUS indicating if the operation
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * was successful or if an error occurred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_SUCCESS Returned if the max receive
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * data segment length properties
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * have been successfully retrieved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_PARAMETER Returned if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @a pProps is NULL or specifies a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * memory area to which data cannot be written.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @a lhbaId does not specify any
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * valid object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * a lhbaId does not specify a LHBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lhbaId does not specify a LHBA
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * which is currently known to the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetMaxRecvDataSegmentLengthProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_MIN_MAX_VALUE *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetMaxRecvDataSegmentLengthPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IMA_GMRDSLPFN IMA_GetMaxRecvDataSegmentLengthPropertiesFn
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IMA_GMRDSLP "IMA_GetMaxRecvDataSegmentLengthProperties"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GMRDSLPFN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GMRDSLP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GMRDSLPFN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GMRDSLP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#undef IMA_GMRDSLPFN
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#undef IMA_GMRDSLP
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* --------------------------------------------- */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_PluginIOCtl(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID pluginOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT command,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const void *pInputBuffer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT inputBufferLength,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *pOutputBuffer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT *pOutputBufferLength) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_PluginIOCtlFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pInputBuffer == NULL || inputBufferLength == 0 ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pOutputBuffer == NULL || pOutputBufferLength == NULL ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *pOutputBufferLength == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pluginOid.objectType != IMA_OBJECT_TYPE_PLUGIN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == pluginOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_PluginIOCtlFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_PluginIOCtl");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_PluginIOCtlFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_PluginIOCtl");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginOid, command,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pInputBuffer, inputBufferLength,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pOutputBuffer, pOutputBufferLength);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetNetworkPortalOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lnpId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetNetworkPortalOidListFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lnpId.objectType != IMA_OBJECT_TYPE_LNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lnpId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetNetworkPortalOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNetworkPortalOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetNetworkPortalOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNetworkPortalOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT listSize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte listSize = sizeof (IMA_OID_LIST);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(lnpId, &ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (IMA_SUCCESS(status)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList = (IMA_OID_LIST*)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte calloc(1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID_LIST)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte + (ppOidList->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oidCount - 1)*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppList) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EUOS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcpy((*ppList),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte listSize
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte + (ppOidList->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oidCount - 1)*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetFirstBurstLength(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT firstBurstLength) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetFirstBurstLengthFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetFirstBurstLengthFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetFirstBurstLength");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetFirstBurstLengthFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetFirstBurstLength");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId, firstBurstLength);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetMaxBurstLength(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT maxBurstLength) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetMaxBurstLengthFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetMaxBurstLengthFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetMaxBurstLength");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetMaxBurstLengthFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetMaxBurstLength");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId, maxBurstLength);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetMaxRecvDataSegmentLength(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT maxRecvDataSegmentLength) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetMaxRecvDataSegmentLengthFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetMaxRecvDataSegmentLengthFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetMaxRecvDataSegmentLength");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetMaxRecvDataSegmentLengthFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetMaxRecvDataSegmentLength");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte maxRecvDataSegmentLength);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetMaxConnectionsProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_MIN_MAX_VALUE *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetMaxConnectionsPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetMaxConnectionsPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetMaxConnectionsProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetMaxConnectionsPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetMaxConnectionsProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetMaxConnections(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT maxConnections) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetMaxConnectionsFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetMaxConnectionsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetMaxConnections");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetMaxConnectionsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetMaxConnections");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId, maxConnections);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetDefaultTime2RetainProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_MIN_MAX_VALUE *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetDefaultTime2RetainPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetDefaultTime2RetainPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDefaultTime2RetainProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetDefaultTime2RetainPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDefaultTime2RetainProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(lhbaId, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetDefaultTime2Retain(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT defaultTime2Retain) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetDefaultTime2RetainFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetDefaultTime2RetainFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetDefaultTime2Retain");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetDefaultTime2RetainFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetDefaultTime2Retain");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId, defaultTime2Retain);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetDefaultTime2WaitProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_MIN_MAX_VALUE *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetDefaultTime2WaitPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetDefaultTime2WaitPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDefaultTime2WaitProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetDefaultTime2WaitPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDefaultTime2WaitProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(lhbaId, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetDefaultTime2Wait(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT defaultTime2Wait) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetDefaultTime2WaitFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetDefaultTime2WaitFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetDefaultTime2Wait");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetDefaultTime2WaitFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetDefaultTime2Wait");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId, defaultTime2Wait);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetMaxOutstandingR2TProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_MIN_MAX_VALUE *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetMaxOutstandingR2TPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetMaxOutstandingR2TPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetMaxOutstandingR2TProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetMaxOutstandingR2TPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetMaxOutstandingR2TProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetMaxOutstandingR2T(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT maxOutstandingR2T) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetMaxOutstandingR2TFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetMaxOutstandingR2TFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetMaxOutstandingR2T");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetMaxOutstandingR2TFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetMaxOutstandingR2T");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaId, maxOutstandingR2T);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetErrorRecoveryLevelProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_MIN_MAX_VALUE *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetMaxOutstandingR2TPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetErrorRecoveryLevelPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetErrorRecoveryLevelProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetErrorRecoveryLevelPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetErrorRecoveryLevelProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetErrorRecoveryLevel(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT errorRecoveryLevel) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetErrorRecoveryLevelFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetErrorRecoveryLevelFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetErrorRecoveryLevel");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetErrorRecoveryLevelFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetErrorRecoveryLevel");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid, errorRecoveryLevel);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetInitialR2TProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL_VALUE *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetInitialR2TPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetInitialR2TPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetInitialR2TProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetInitialR2TPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetInitialR2TProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetInitialR2T(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL initialR2T)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetInitialR2TFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (initialR2T != IMA_TRUE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte initialR2T != IMA_FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetInitialR2TFn) GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetInitialR2T");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetInitialR2TFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetInitialR2T");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, initialR2T);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetImmediateDataProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL_VALUE *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetImmediateDataPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetImmediateDataPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetImmediateDataProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetImmediateDataPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetImmediateDataProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetImmediateData(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL immediateData) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetImmediateDataFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (immediateData != IMA_TRUE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte immediateData != IMA_FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetImmediateDataFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetImmediateData");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetImmediateDataFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetImmediateData");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, immediateData);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetDataPduInOrderProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL_VALUE *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetDataPduInOrderPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetDataPduInOrderPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDataPduInOrderProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetDataPduInOrderPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDataPduInOrderProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetDataPduInOrder(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL dataPduInOrder) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetDataPduInOrderFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dataPduInOrder != IMA_TRUE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dataPduInOrder != IMA_FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetDataPduInOrderFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetDataPduInOrder");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetDataPduInOrderFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetDataPduInOrder");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, dataPduInOrder);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetDataSequenceInOrderProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL_VALUE *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetDataSequenceInOrderPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetDataSequenceInOrderPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDataSequenceInOrderProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetDataSequenceInOrderPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDataSequenceInOrderProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetDataSequenceInOrder(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL dataSequenceInOrder) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetDataSequenceInOrderFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dataSequenceInOrder != IMA_TRUE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dataSequenceInOrder != IMA_FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetDataSequenceInOrderFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetDataSequenceInOrder");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetDataSequenceInOrderFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetDataSequenceInOrder");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid, dataSequenceInOrder);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetStatisticsCollection(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL enableStatisticsCollection) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetStatisticsCollectionFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (enableStatisticsCollection != IMA_TRUE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enableStatisticsCollection != IMA_FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_PHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetStatisticsCollectionFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetStatisticsCollection");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetStatisticsCollectionFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetStatisticsCollection");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid, enableStatisticsCollection);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetNetworkPortStatus(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID portOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_NETWORK_PORT_STATUS *pStatus) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetNetworkPortStatusFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pStatus == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (portOid.objectType != IMA_OBJECT_TYPE_PNP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portOid.objectType != IMA_OBJECT_TYPE_LNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == portOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetNetworkPortStatusFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNetworkPortStatus");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetNetworkPortStatusFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNetworkPortStatus");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(portOid, pStatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetTargetOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetTargetOidListFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_LNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetTargetOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetTargetOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetTargetOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetTargetOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT listSize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte listSize = sizeof (IMA_OID_LIST);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, &ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (IMA_SUCCESS(status)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_OID_LIST*)calloc(1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID_LIST) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((ppOidList->oidCount - 1)*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppList) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EUOS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcpy((*ppList),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList, listSize
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte + (ppOidList->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oidCount - 1)*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_RemoveStaleData(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_RemoveStaleDataFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_RemoveStaleDataFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_RemoveStaleData");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_RemoveStaleDataFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_RemoveStaleData");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(lhbaId);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetIsnsDiscovery(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID phbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL enableIsnsDiscovery,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_ISNS_DISCOVERY_METHOD discoveryMethod,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_HOST_ID *iSnsHost) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetIsnsDiscoveryFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (enableIsnsDiscovery != IMA_TRUE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enableIsnsDiscovery != IMA_FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (enableIsnsDiscovery == IMA_TRUE && iSnsHost == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (discoveryMethod != IMA_ISNS_DISCOVERY_METHOD_STATIC &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte discoveryMethod != IMA_ISNS_DISCOVERY_METHOD_DHCP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte discoveryMethod != IMA_ISNS_DISCOVERY_METHOD_SLP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phbaId.objectType != IMA_OBJECT_TYPE_LHBA) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == phbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetIsnsDiscoveryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetIsnsDiscovery");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetIsnsDiscoveryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetIsnsDiscovery");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(phbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enableIsnsDiscovery,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte discoveryMethod, iSnsHost);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetSlpDiscovery(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID phbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL enableSlpDiscovery) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetSlpDiscoveryFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (enableSlpDiscovery != IMA_TRUE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enableSlpDiscovery != IMA_FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phbaId.objectType != IMA_OBJECT_TYPE_LHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == phbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetSlpDiscoveryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetSlpDiscovery");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetSlpDiscoveryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetSlpDiscovery");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enableSlpDiscovery);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetStaticDiscovery(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID phbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL enableStaticDiscovery) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetStaticDiscoveryFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (enableStaticDiscovery != IMA_TRUE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enableStaticDiscovery != IMA_FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phbaId.objectType != IMA_OBJECT_TYPE_LHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == phbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetStaticDiscoveryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetStaticDiscovery");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetStaticDiscoveryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetStaticDiscovery");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enableStaticDiscovery);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetSendTargetsDiscovery(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID phbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL enableSendTargetsDiscovery) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetSendTargetsDiscoveryFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (enableSendTargetsDiscovery != IMA_TRUE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enableSendTargetsDiscovery != IMA_FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phbaId.objectType != IMA_OBJECT_TYPE_LHBA) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == phbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetSendTargetsDiscoveryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetSendTargetsDiscovery");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetSendTargetsDiscoveryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetSendTargetsDiscovery");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enableSendTargetsDiscovery);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * this forces plugins to rescan all iscsi targets on this
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ipaddress/port and return a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * list of discovered targets.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ERROR/todo:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * according to IMA spec., pTargetOidList is allocated by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the caller for library to return data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * how does a caller know how much space it will be?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pTargetOidList should be allocated by the library/plugin
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * like IMA_GetLnpOidList
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_AddPhbaStaticDiscoveryTarget(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID phbaOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_TARGET_ADDRESS targetAddress,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **pTargetOidList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_AddPhbaStaticDiscoveryTargetFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == phbaOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_AddPhbaStaticDiscoveryTargetFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_AddPhbaStaticDiscoveryTarget");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_AddPhbaStaticDiscoveryTargetFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_AddPhbaStaticDiscoveryTarget");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT listSize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte listSize =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID_LIST);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(phbaOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte targetAddress, &ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (IMA_SUCCESS(status)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*pTargetOidList) =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_OID_LIST*)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte calloc(1, listSize +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ppOidList->oidCount-1)*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*pTargetOidList) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EUOS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcpy((*pTargetOidList),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte listSize +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ppOidList->oidCount-1)*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_RemovePhbaStaticDiscoveryTarget(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID phbaOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID targetOid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_RemovePhbaStaticDiscoveryTargetFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == targetOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_RemovePhbaStaticDiscoveryTargetFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_RemovePhbaStaticDiscoveryTarget");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_RemovePhbaStaticDiscoveryTargetFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_RemovePhbaStaticDiscoveryTarget");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(phbaOid, targetOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetPnpOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetPnpOidListFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_PHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_LNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPnpOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPnpOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPnpOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPnpOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, &ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (IMA_SUCCESS(status)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT listSize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte listSize =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID_LIST);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList = (IMA_OID_LIST*)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte calloc(1, listSize +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ppOidList->oidCount-1)*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppList) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EUOS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcpy((*ppList),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte listSize +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ppOidList->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oidCount - 1)*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetPhbaDownloadProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID phbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_PHBA_DOWNLOAD_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetPhbaDownloadPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == phbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetPhbaDownloadPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPhbaDownloadProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPhbaDownloadPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPhbaDownloadProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(phbaId, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_IsPhbaDownloadFile(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID phbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_WCHAR *pFileName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_PHBA_DOWNLOAD_IMAGE_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_IsPhbaDownloadFileFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pFileName == NULL || pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == phbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_IsPhbaDownloadFileFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_IsPhbaDownloadFile");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_IsPhbaDownloadFileFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_IsPhbaDownloadFile");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phbaId, pFileName, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_PhbaDownload(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID phbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_PHBA_DOWNLOAD_IMAGE_TYPE imageType,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_WCHAR *pFileName) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_PhbaDownloadFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (imageType != IMA_DOWNLOAD_IMAGE_TYPE_FIRMWARE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte imageType != IMA_DOWNLOAD_IMAGE_TYPE_OPTION_ROM &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte imageType != IMA_DOWNLOAD_IMAGE_TYPE_ALL &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte imageType != IMA_DOWNLOAD_IMAGE_TYPE_BOOTCODE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pFileName == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == phbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_PhbaDownloadFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_PhbaDownload");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_PhbaDownloadFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_PhbaDownload");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phbaId, imageType, pFileName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetNetworkPortalProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID networkPortalId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_NETWORK_PORTAL_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetNetworkPortalPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (networkPortalId.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == networkPortalId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetNetworkPortalPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNetworkPortalProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetNetworkPortalPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetNetworkPortalProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte networkPortalId, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetNetworkPortalIpAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID networkPortalId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_IP_ADDRESS NewIpAddress) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetNetworkPortalIpAddressFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (networkPortalId.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == networkPortalId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_SetNetworkPortalIpAddressFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetNetworkPortalIpAddress");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetNetworkPortalIpAddressFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetNetworkPortalIpAddress");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte networkPortalId, NewIpAddress);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetLnpOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetLnpOidListFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // Get total id count first
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLnpOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLnpOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLnpOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLnpOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(&ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount += ppOidList->oidCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList = (IMA_OID_LIST*)calloc(1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID_LIST) + (totalIdCount - 1)* sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppList) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_UNEXPECTED_OS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount = totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // 2nd pass to copy the id lists
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLnpOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLnpOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLnpOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLnpOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(&ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; (j < ppOidList->oidCount) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (totalIdCount <
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectType =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectSequenceNumber =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectSequenceNumber;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ownerId =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].ownerId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(*ppList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetLnpProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lnpId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_LNP_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetLnpPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lnpId.objectType != IMA_OBJECT_TYPE_LNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lnpId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLnpPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLnpProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLnpPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLnpProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(lnpId, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetPnpProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID pnpId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_PNP_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetPnpPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pnpId.objectType != IMA_OBJECT_TYPE_PNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == pnpId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPnpPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPnpProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPnpPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPnpProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(pnpId, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetPnpStatistics(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID pnpId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_PNP_STATISTICS *pStats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetPnpStatisticsFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pStats == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pnpId.objectType != IMA_OBJECT_TYPE_PNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == pnpId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPnpStatisticsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPnpStatistics");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPnpStatisticsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPnpStatistics");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(pnpId, pStats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetTargetProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID targetId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_TARGET_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetTargetPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (targetId.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == targetId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetTargetPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetTargetProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetTargetPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetTargetProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(targetId, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetSessionProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID sessionId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SESSION_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetSessionPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sessionId.objectType != IMA_OBJECT_TYPE_SESSION)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == sessionId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetSessionPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetSessionProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetSessionPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetSessionProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(sessionId, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetConnectionProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID connectionId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_CONNECTION_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetConnectionPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (connectionId.objectType != IMA_OBJECT_TYPE_CONNECTION)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == connectionId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetConnectionPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetConnectionProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetConnectionPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetConnectionProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(connectionId, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetTargetErrorStatistics(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID targetId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_TARGET_ERROR_STATISTICS *pStats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetTargetErrorStatisticsFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pStats == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (targetId.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == targetId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetTargetErrorStatisticsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetTargetErrorStatistics");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetTargetErrorStatisticsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetTargetErrorStatistics");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(targetId, pStats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetLuOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetLuOidListFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLuOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLuOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLuOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLuOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, &ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (IMA_SUCCESS(status)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT listSize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte listSize =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID_LIST);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList = (IMA_OID_LIST*)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte calloc(1, listSize +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ppOidList->oidCount - 1)*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppList) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = EUOS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcpy((*ppList),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte listSize +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ppOidList->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oidCount - 1)*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetLuOid(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID targetId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT64 lun,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID *pluId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetLuOidFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pluId == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (targetId.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == targetId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLuOidFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLuOid");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLuOidFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLuOid");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc(targetId, lun, pluId);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetLuProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID luId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_LU_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetLuPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (luId.objectType != IMA_OBJECT_TYPE_LU)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == luId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLuPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLuProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetLuPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetLuProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(luId, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetStatisticsProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATISTICS_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetStatisticsPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_TARGET &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_LU &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_PNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetStatisticsPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetStatisticsProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetStatisticsPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetStatisticsProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetDeviceStatistics(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_DEVICE_STATISTICS *pStats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetDeviceStatisticsFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pStats == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_LU &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetDeviceStatisticsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDeviceStatistics");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetDeviceStatisticsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDeviceStatistics");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid, pStats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_LuInquiry(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID deviceId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL evpd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL cmddt,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BYTE pageCode,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BYTE *pOutputBuffer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT *pOutputBufferLength,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BYTE *pSenseBuffer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT *pSenseBufferLength) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_LuInquiryFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pOutputBuffer == NULL || pOutputBufferLength == NULL ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *pOutputBufferLength == 0 ||
146832db19eb2048b216b5dd0ba4424c7d0dfd17Milos Muzik (pSenseBuffer == NULL && pSenseBufferLength != NULL &&
146832db19eb2048b216b5dd0ba4424c7d0dfd17Milos Muzik *pSenseBufferLength != 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((evpd != IMA_TRUE && evpd != IMA_FALSE) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (cmddt != IMA_TRUE && cmddt != IMA_FALSE))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (deviceId.objectType != IMA_OBJECT_TYPE_TARGET &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte deviceId.objectType != IMA_OBJECT_TYPE_LU)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == deviceId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_LuInquiryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_LuInquiry");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_LuInquiryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_LuInquiry");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc(deviceId, evpd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmddt, pageCode,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pOutputBuffer, pOutputBufferLength,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pSenseBuffer, pSenseBufferLength);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_LuReadCapacity(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID deviceId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT cdbLength,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BYTE *pOutputBuffer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT *pOutputBufferLength,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BYTE *pSenseBuffer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT *pSenseBufferLength) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_LuReadCapacityFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cdbLength != 10 && cdbLength != 16)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((pOutputBuffer == NULL || pOutputBufferLength == NULL ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *pOutputBufferLength == 0) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pSenseBuffer == NULL && pSenseBufferLength != NULL &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *pSenseBufferLength != 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (deviceId.objectType != IMA_OBJECT_TYPE_TARGET &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte deviceId.objectType != IMA_OBJECT_TYPE_LU)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == deviceId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_LuReadCapacityFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_LuReadCapacity");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_LuReadCapacityFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_LuReadCapacity");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(deviceId, cdbLength,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pOutputBuffer, pOutputBufferLength,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pSenseBuffer, pSenseBufferLength);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_LuReportLuns(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID deviceId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL sendToWellKnownLun,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BYTE selectReport,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BYTE *pOutputBuffer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT *pOutputBufferLength,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BYTE *pSenseBuffer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT *pSenseBufferLength) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_LuReportLunsFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((pOutputBuffer == NULL || pOutputBufferLength == NULL ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *pOutputBufferLength == 0) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pSenseBuffer == NULL && pSenseBufferLength != NULL &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *pSenseBufferLength != 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sendToWellKnownLun != IMA_TRUE && sendToWellKnownLun != IMA_FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (deviceId.objectType != IMA_OBJECT_TYPE_TARGET &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte deviceId.objectType != IMA_OBJECT_TYPE_LU)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == deviceId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_LuReportLunsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_LuReportLuns");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_LuReportLunsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_LuReportLuns");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(deviceId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sendToWellKnownLun, selectReport,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pOutputBuffer, pOutputBufferLength,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pSenseBuffer, pSenseBufferLength);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_ExposeLu(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID luId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_ExposeLuFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (luId.objectType != IMA_OBJECT_TYPE_LU)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == luId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_ExposeLuFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_ExposeLu");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_ExposeLuFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_ExposeLu");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(luId);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_UnexposeLu(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID luId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UnexposeLuFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (luId.objectType != IMA_OBJECT_TYPE_LU)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == luId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_UnexposeLuFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_UnexposeLu");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_UnexposeLuFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_UnexposeLu");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(luId);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetPhbaStatus(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID hbaId,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_PHBA_STATUS *pStatus) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetPhbaStatusFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pStatus == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (hbaId.objectType != IMA_OBJECT_TYPE_PHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == hbaId.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPhbaStatusFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPhbaStatus");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetPhbaStatusFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetPhbaStatus");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(hbaId, pStatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_RegisterForObjectVisibilityChanges(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OBJECT_VISIBILITY_FN pClientFn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_RegisterForObjectVisibilityChangesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pClientFn == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].number_of_vbcallbacks >=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_MAX_CALLBACK_PER_PLUGIN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check if registered already */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j < plugintable[i].number_of_vbcallbacks; j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].vbcallback[j] == pClientFn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_RegisterForObjectVisibilityChangesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_RegisterForObjectVisibilityChanges");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_RegisterForObjectVisibilityChangesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_RegisterForObjectVisibilityChanges");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(VisibilityCallback);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j = plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte number_of_vbcallbacks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].vbcallback[j] =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pClientFn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte number_of_vbcallbacks++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_DeregisterForObjectVisibilityChanges(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OBJECT_VISIBILITY_FN pClientFn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_DeregisterForObjectVisibilityChangesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pClientFn == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check if deregistered already */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j < plugintable[i].number_of_vbcallbacks; j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].vbcallback[j] == pClientFn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * use IMA_ERROR_UNKNOWN_ERROR
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * as a flag
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNKNOWN_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_DeregisterForObjectVisibilityChangesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_DeregisterForObjectVisibilityChanges");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_DeregisterForObjectVisibilityChangesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_DeregisterForObjectVisibilityChanges");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(VisibilityCallback);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * where plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * vbcallback[j] == pClientFn
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (; j <
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte number_of_vbcallbacks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vbcallback[j] =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vbcallback[j+1];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte number_of_vbcallbacks--;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_RegisterForObjectPropertyChanges(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OBJECT_PROPERTY_FN pClientFn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_RegisterForObjectPropertyChangesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pClientFn == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].number_of_pccallbacks >=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_MAX_CALLBACK_PER_PLUGIN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check if registered already */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j < plugintable[i].number_of_pccallbacks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].pccallback[j] ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pClientFn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_RegisterForObjectPropertyChangesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_RegisterForObjectPropertyChanges");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_RegisterForObjectPropertyChangesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_RegisterForObjectPropertyChanges");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(PropertyCallback);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j = plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte number_of_pccallbacks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].pccallback[j] =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pClientFn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte number_of_pccallbacks++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_DeregisterForObjectPropertyChanges(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OBJECT_PROPERTY_FN pClientFn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_DeregisterForObjectPropertyChangesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pClientFn == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check if deregistered already */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j < plugintable[i].number_of_pccallbacks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].pccallback[j] ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pClientFn) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * use IMA_ERROR_UNKNOWN_ERROR
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * as a flag
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNKNOWN_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_DeregisterForObjectPropertyChangesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_DeregisterForObjectPropertyChanges");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_DeregisterForObjectPropertyChangesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_DeregisterForObjectPropertyChanges");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(PropertyCallback);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * where plugintable[i].vbcallback[
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * j] == pClientFn
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (; j < plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte number_of_pccallbacks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pccallback[j]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte = plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pccallback[j+1];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte number_of_pccallbacks--;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetIpProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_IP_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetIpPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_PNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetIpPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetIpProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetIpPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetIpProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetIpConfigMethod(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL enableDhcpIpConfiguration) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetIpConfigMethodFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (enableDhcpIpConfiguration != IMA_TRUE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enableDhcpIpConfiguration != IMA_FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_PNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetIpConfigMethodFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetIpConfigMethod");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetIpConfigMethodFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetIpConfigMethod");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enableDhcpIpConfiguration);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetSubnetMask(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_IP_ADDRESS subnetMask) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetSubnetMaskFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_PNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetSubnetMaskFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetSubnetMask");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetSubnetMaskFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetSubnetMask");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid, subnetMask);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetDnsServerAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_IP_ADDRESS *primaryDnsServerAddress,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_IP_ADDRESS *alternateDnsServerAddress) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetDnsServerAddressFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (primaryDnsServerAddress == NULL &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte alternateDnsServerAddress != NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (primaryDnsServerAddress != NULL &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte alternateDnsServerAddress != NULL &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcmp(primaryDnsServerAddress->ipAddress,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte alternateDnsServerAddress->ipAddress,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (primaryDnsServerAddress->ipAddress)) == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_PNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetDnsServerAddressFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetDnsServerAddress");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetDnsServerAddressFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetDnsServerAddress");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte primaryDnsServerAddress,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte alternateDnsServerAddress);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetDefaultGateway(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_IP_ADDRESS defaultGateway) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetDefaultGatewayFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_PNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetDefaultGatewayFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetDefaultGateway");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetDefaultGatewayFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetDefaultGateway");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid, defaultGateway);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetSupportedAuthMethods(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_BOOL getSettableMethods,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT *pMethodCount,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_AUTHMETHOD *pMethodList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetSupportedAuthMethodsFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pMethodCount == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetSupportedAuthMethodsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetSupportedAuthMethods");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetSupportedAuthMethodsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetSupportedAuthMethods");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(lhbaOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getSettableMethods,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pMethodCount, pMethodList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetInUseInitiatorAuthMethods(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT *pMethodCount,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_AUTHMETHOD *pMethodList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetInUseInitiatorAuthMethodsFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pMethodCount == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetInUseInitiatorAuthMethodsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetInUseInitiatorAuthMethods");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetInUseInitiatorAuthMethodsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetInUseInitiatorAuthMethods");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(lhbaOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pMethodCount, pMethodList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetInitiatorAuthParms(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_AUTHMETHOD method,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_INITIATOR_AUTHPARMS *pParms) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetInitiatorAuthParmsFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pParms == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (method != IMA_AUTHMETHOD_NONE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte method != IMA_AUTHMETHOD_CHAP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte method != IMA_AUTHMETHOD_SRP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte method != IMA_AUTHMETHOD_KRB5 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte method != IMA_AUTHMETHOD_SPKM1 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte method != IMA_AUTHMETHOD_SPKM2)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetInitiatorAuthParmsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetInitiatorAuthParms");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetInitiatorAuthParmsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetInitiatorAuthParms");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(lhbaOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte method, pParms);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetInitiatorAuthMethods(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT methodCount,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_AUTHMETHOD *pMethodList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetInitiatorAuthMethodsFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (methodCount == 0 || pMethodList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetInitiatorAuthMethodsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetInitiatorAuthMethods");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetInitiatorAuthMethodsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetInitiatorAuthMethods");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(lhbaOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte methodCount, pMethodList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_SetInitiatorAuthParms(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID lhbaOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_AUTHMETHOD method,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_INITIATOR_AUTHPARMS *pParms) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_SetInitiatorAuthParmsFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pParms == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (method != IMA_AUTHMETHOD_NONE &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte method != IMA_AUTHMETHOD_CHAP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte method != IMA_AUTHMETHOD_SRP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte method != IMA_AUTHMETHOD_KRB5 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte method != IMA_AUTHMETHOD_SPKM1 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte method != IMA_AUTHMETHOD_SPKM2)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == lhbaOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetInitiatorAuthParmsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetInitiatorAuthParms");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_SetInitiatorAuthParmsFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_SetInitiatorAuthParms");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lhbaOid, method, pParms);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetStaticDiscoveryTargetOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetStaticDiscoveryTargetOidListFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_PNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetStaticDiscoveryTargetOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetStaticDiscoveryTargetOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetStaticDiscoveryTargetOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetStaticDiscoveryTargetOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid, ppList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetDiscoveryProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_DISCOVERY_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetDiscoveryPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_PHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_LHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetDiscoveryPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDiscoveryProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetDiscoveryPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDiscoveryProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_AddDiscoveryAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_TARGET_ADDRESS discoveryAddress,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID *pDiscoveryAddressOid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_AddDiscoveryAddressFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_PNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_AddDiscoveryAddressFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_AddDiscoveryAddress");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_AddDiscoveryAddressFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_AddDiscoveryAddress");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte discoveryAddress,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pDiscoveryAddressOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_AddStaticDiscoveryTarget(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const IMA_STATIC_DISCOVERY_TARGET staticDiscoveryTarget,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID *pStaticDiscoveryTargetOid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_AddStaticDiscoveryTargetFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_PNP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_AddStaticDiscoveryTargetFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_AddStaticDiscoveryTarget");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_AddStaticDiscoveryTargetFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_AddStaticDiscoveryTarget");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte staticDiscoveryTarget,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pStaticDiscoveryTargetOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_CommitHbaParameters(IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_COMMIT_LEVEL commitLevel)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_CommitHbaParametersFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_LHBA &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_PHBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_CommitHbaParametersFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_CommitHbaParameters");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_CommitHbaParametersFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_CommitHbaParameters");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid, commitLevel);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_RemoveStaticDiscoveryTarget(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_RemoveStaticDiscoveryTargetFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_RemoveStaticDiscoveryTargetFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_RemoveStaticDiscoveryTarget");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_RemoveStaticDiscoveryTargetFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_RemoveStaticDiscoveryTarget");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetStaticDiscoveryTargetProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID staticDiscoveryTargetOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATIC_DISCOVERY_TARGET_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetStaticDiscoveryTargetPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (staticDiscoveryTargetOid.objectType !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte staticDiscoveryTargetOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetStaticDiscoveryTargetPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetStaticDiscoveryTargetProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetStaticDiscoveryTargetPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetStaticDiscoveryTargetProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte staticDiscoveryTargetOid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetDiscoveryAddressOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetDiscoveryAddressOidListFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((Oid.objectType != IMA_OBJECT_TYPE_LHBA) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Oid.objectType != IMA_OBJECT_TYPE_PNP)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // Get total id count first
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetDiscoveryAddressOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDiscoveryAddressOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetDiscoveryAddressOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDiscoveryAddressOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, &ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount +=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oidCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (totalIdCount - 1)* sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppList) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_UNEXPECTED_OS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount = totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // 2nd pass to copy the id lists
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetDiscoveryAddressOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDiscoveryAddressOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetDiscoveryAddressOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDiscoveryAddressOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, &ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (j < ppOidList->oidCount) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (totalIdCount <
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OBJ_SEQ_NUM ppOidList->oids[j].objectSequenceNumber
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte [totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectType =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectSequenceNumber
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte = OBJ_SEQ_NUM;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ownerId =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oids[j].ownerId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#undef OBJ_SEQ_NUM
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(*ppList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetSessionOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetSessionOidListFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((Oid.objectType != IMA_OBJECT_TYPE_LHBA) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Oid.objectType != IMA_OBJECT_TYPE_TARGET)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // Get total id count first
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetSessionOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetSessionOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetSessionOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetSessionOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, &ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount +=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oidCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (totalIdCount - 1)* sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppList) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_UNEXPECTED_OS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount = totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // 2nd pass to copy the id lists
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetSessionOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetSessionOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetSessionOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetSessionOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, &ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (j < ppOidList->oidCount) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (totalIdCount <
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OBJ_SEQ_NUM ppOidList->oids[j].objectSequenceNumber
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectType =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectSequenceNumber
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte = OBJ_SEQ_NUM;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oids[
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ownerId =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ownerId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#undef OBJ_SEQ_NUM
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(*ppList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetConnectionOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID Oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST **ppList) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetSessionOidListFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppList == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (Oid.objectType != IMA_OBJECT_TYPE_SESSION) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // Get total id count first
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetConnectionOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetConnectionOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetConnectionOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetConnectionOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, &ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount +=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oidCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte + (totalIdCount - 1)* sizeof (IMA_OID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppList) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_UNEXPECTED_OS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount = totalIdCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // 2nd pass to copy the id lists
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == Oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetConnectionOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetConnectionOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetConnectionOidListFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetConnectionOidList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID_LIST *ppOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(Oid, &ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j < ppOidList->oidCount) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (totalIdCount <
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->oidCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OBJ_SEQ_NUM ppOidList->oids[j].objectSequenceNumber
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectType =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oids[j].objectType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte objectSequenceNumber
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte = OBJ_SEQ_NUM;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ppList)->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oids[totalIdCount].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ownerId =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppOidList->oids[j].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ownerId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totalIdCount++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#undef OBJ_SEQ_NUM
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status != IMA_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(*ppList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_RemoveDiscoveryAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID discoveryAddressOid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_RemoveDiscoveryAddressFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (discoveryAddressOid.objectType !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OBJECT_TYPE_DISCOVERY_ADDRESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == discoveryAddressOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_RemoveDiscoveryAddressFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_RemoveDiscoveryAddress");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_RemoveDiscoveryAddressFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_RemoveDiscoveryAddress");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(discoveryAddressOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetIpsecProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_IPSEC_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetIpsecPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_PNP &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oid.objectType != IMA_OBJECT_TYPE_LHBA) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetIpsecPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetIpsecProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetIpsecPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetIpsecProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetAddressKeys(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID targetOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_ADDRESS_KEYS **ppKeys) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetAddressKeysFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_FreeMemoryFn FreeFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ppKeys == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (targetOid.objectType != IMA_OBJECT_TYPE_TARGET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == targetOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetAddressKeysFn) GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetAddressKeys");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc = (IMA_GetAddressKeysFn) dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetAddressKeys");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_ADDRESS_KEYS *ppKeysList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT addrSize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addrSize = sizeof (IMA_ADDRESS_KEYS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc(targetOid, &ppKeysList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (IMA_SUCCESS(status)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ppKeys =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_ADDRESS_KEYS*)calloc(1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addrSize +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ppKeysList->addressKeyCount
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte - 1) * addrSize);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*ppKeys) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = EUOS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcpy((*ppKeys),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ppKeysList,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addrSize +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ppKeysList->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addressKeyCount-1)*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addrSize);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc = (IMA_FreeMemoryFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_FreeMemory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (FreeFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeFunc(ppKeysList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS IMA_GetDiscoveryAddressProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_DISCOVERY_ADDRESS_PROPERTIES *pProps) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_GetDiscoveryAddressPropertiesFn PassFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pProps == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (oid.objectType != IMA_OBJECT_TYPE_DISCOVERY_ADDRESS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == oid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetDiscoveryAddressPropertiesFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDiscoveryAddressProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PassFunc =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (IMA_GetDiscoveryAddressPropertiesFn) dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IMA_GetDiscoveryAddressProperties");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PassFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = PassFunc(oid, pProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteIMA_API IMA_STATUS QIMA_SetUpdateInterval(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_OID pluginOid, time_t interval) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QIMA_SetUpdateIntervalFn updFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IMA_STATUS status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (number_of_plugins == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InitLibrary();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (interval <= 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((pluginOid.objectType != IMA_OBJECT_TYPE_PLUGIN) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pluginOid.objectSequenceNumber != 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (IMA_ERROR_INVALID_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_OBJECT_NOT_FOUND;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < number_of_plugins; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].ownerId == pluginOid.ownerId) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = IMA_ERROR_UNEXPECTED_OS_ERROR;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plugintable[i].hPlugin != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_obtainmutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef WIN32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte updFunc = (QIMA_SetUpdateIntervalFn)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QIMA_SetUpdateInterval");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte updFunc = (QIMA_SetUpdateIntervalFn) dlsym(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plugintable[i].hPlugin,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QIMA_SetUpdateInterval");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (updFunc != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = updFunc(pluginOid, interval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(plugintable[i].pluginMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte os_releasemutex(libMutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}