diff options
Diffstat (limited to 'usr/src/lib/libima')
| -rw-r--r-- | usr/src/lib/libima/Makefile | 56 | ||||
| -rw-r--r-- | usr/src/lib/libima/Makefile.com | 71 | ||||
| -rw-r--r-- | usr/src/lib/libima/amd64/Makefile | 33 | ||||
| -rw-r--r-- | usr/src/lib/libima/common/ima-lib.c | 7420 | ||||
| -rw-r--r-- | usr/src/lib/libima/common/ima-plugin.h | 634 | ||||
| -rw-r--r-- | usr/src/lib/libima/common/ima.conf | 35 | ||||
| -rw-r--r-- | usr/src/lib/libima/common/ima.h | 2434 | ||||
| -rw-r--r-- | usr/src/lib/libima/common/license.html | 397 | ||||
| -rw-r--r-- | usr/src/lib/libima/common/llib-lima | 29 | ||||
| -rw-r--r-- | usr/src/lib/libima/common/mapfile-vers | 129 | ||||
| -rw-r--r-- | usr/src/lib/libima/i386/Makefile | 31 | ||||
| -rw-r--r-- | usr/src/lib/libima/sparc/Makefile | 31 | ||||
| -rw-r--r-- | usr/src/lib/libima/sparcv9/Makefile | 33 |
13 files changed, 11333 insertions, 0 deletions
diff --git a/usr/src/lib/libima/Makefile b/usr/src/lib/libima/Makefile new file mode 100644 index 0000000000..1e20247293 --- /dev/null +++ b/usr/src/lib/libima/Makefile @@ -0,0 +1,56 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# + +include ../Makefile.lib + +HDRS= ima.h +HDRDIR= common +SUBDIRS= $(MACH) +$(BUILD64)SUBDIRS += $(MACH64) + +all := TARGET = all +clean := TARGET = clean +clobber := TARGET = clobber +install := TARGET = install +lint := TARGET = lint + +.KEEP_STATE: + +install_h: $(ROOTHDRS) + +all clean clobber install lint: $(SUBDIRS) + +install_h: $(ROOTHDRS) + +# These headers and source should be excluded from check target +check: + +$(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) $(TARGET) + +FRC: + +include ../Makefile.targ diff --git a/usr/src/lib/libima/Makefile.com b/usr/src/lib/libima/Makefile.com new file mode 100644 index 0000000000..a8b4a30963 --- /dev/null +++ b/usr/src/lib/libima/Makefile.com @@ -0,0 +1,71 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# + +LIBRARY= libima.a +VERS= .1 +OBJECTS= ima-lib.o +CONFIGFILE= ima.conf +ROOTETC= $(ROOT)/etc + +include ../../Makefile.lib + +IETCFILES= $(CONFIGFILE:%=$(ROOTETC)/%) +IETCFILES:= FILEMODE= 644 +IETCFILES:= OWNER= root +IETCFILES:= GROUP= sys + +LIBS = $(DYNLIB) $(LINTLIB) +LDLIBS += -lc + +CFLAGS += -mt +CFLAGS += -v +CFLAGS += -xCC +CFLAGS += -erroff=E_IMPLICIT_DECL_FUNC_RETURN_INT +CFLAGS += -DSOLARIS + +CFLAGS64 += -mt +CFLAGS64 += -v +CFLAGS64 += -xCC +CFLAGS64 += -erroff=E_IMPLICIT_DECL_FUNC_RETURN_INT +CFLAGS64 += -DSOLARIS + +LINTFLAGS += -DSOLARIS +LINTFLAGS64 += -DSOLARIS + +SRCDIR = ../common +$(LINTLIB) := SRCS= $(SRCDIR)/$(LINTSRC) + +$(ROOTETC)/%: ../common/% + $(INS.file) + +.KEEP_STATE: + +all: $(LIBS) $(IETCFILES) + +lint: + @echo "This section is not required to be lint clean" + +include ../../Makefile.targ diff --git a/usr/src/lib/libima/amd64/Makefile b/usr/src/lib/libima/amd64/Makefile new file mode 100644 index 0000000000..02b2100c3d --- /dev/null +++ b/usr/src/lib/libima/amd64/Makefile @@ -0,0 +1,33 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# + +include ../Makefile.com +include ../../Makefile.lib.64 + +all: $(LIBS) + +install: all $(ROOTLIBS64) $(ROOTLINKS64) + diff --git a/usr/src/lib/libima/common/ima-lib.c b/usr/src/lib/libima/common/ima-lib.c new file mode 100644 index 0000000000..3c050ec080 --- /dev/null +++ b/usr/src/lib/libima/common/ima-lib.c @@ -0,0 +1,7420 @@ +/* + * Description + * ImaLib.c - Implements a sample common IMA library + * + * License: + * The contents of this file are subject to the SNIA Public License + * Version 1.0(the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * + * /http://www.snia.org/English/Resources/Code/OpenSource.html + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is SNIA HBA API and IMA general header file + * + * The Initial Developer of the Original Code is: + * Benjamin F. Kuo, Troika Networks, Inc. (benk@troikanetworks.com) + * David Dillard VERITAS Software david.dillard@veritas.com + * + * Contributor(s): + * Jeff Ding, Adaptec, Inc. (jding@corp.adaptec.com) + * + * Changes: + * 09/24/2003 Initial Draft + * (for other changes... see the CVS logs) + * + * 12/15/2003 corrected the defined parameter in IMA_SetPhbaIsnsDiscovery(). + * lower case the computer name as iscsi name in IMA_GenerateNodeName(). + * + * 01/21/2005 Updated to support IMA 1.1.3. + */ + +#ifdef WIN32 +#include <windows.h> +#else +#define _XOPEN_SOURCE /* glibc2 needs this */ +#include <sys/sem.h> +#include <dlfcn.h> +#include <stdarg.h> +#endif + +#include <string.h> +#include <stdlib.h> +// #include <sys/sem.h> +// #include <unistd.h> +#include <time.h> +#include <stdio.h> +#include <sys/types.h> +// #include <sys/ipc.h> + +#include "ima.h" +#include "ima-plugin.h" + + +#define LIBRARY_PROPERTY_SUPPORTED_IMA_VERSION 1 +#define LIBRARY_PROPERTY_IMPLEMENTATION_VERSION L"1.0.2" +#define LIBRARY_PROPERTY_VENDOR L"QLogic, Inc." +#define DEFAULT_NODE_NAME_FORMAT "iqn.1986-03.com.sun.central.%s" + +/* Linux only */ +#define LIBRARY_FILE_NAME L"libima.so" + +#define IMA_MAX_NUM_PLUGINS 32 +#define IMA_MAX_CALLBACK_PER_PLUGIN 64 + +#define EUOS_ERROR IMA_ERROR_UNEXPECTED_OS_ERROR + +typedef struct ima_plugin_info { + char PluginName[64]; + char PluginPath[256]; +#ifdef WIN32 + HINSTANCE hPlugin; /* Handle to a loaded DLL */ +#else + void* hPlugin; /* Handle to a loaded DLL */ +#endif + IMA_UINT32 ownerId; +#ifdef WIN32 + HANDLE pluginMutex; +#else + int pluginMutex; +#endif + IMA_UINT number_of_vbcallbacks; + IMA_OBJECT_VISIBILITY_FN vbcallback[IMA_MAX_CALLBACK_PER_PLUGIN]; + IMA_UINT number_of_pccallbacks; + IMA_OBJECT_PROPERTY_FN pccallback[IMA_MAX_CALLBACK_PER_PLUGIN]; +} IMA_PLUGIN_INFO, *PIMA_PLUGIN_INFO; + +static IMA_PLUGIN_INFO plugintable[IMA_MAX_NUM_PLUGINS]; +static int number_of_plugins = -1; +static IMA_NODE_NAME sharedNodeName; +static IMA_NODE_ALIAS sharedNodeAlias; + +#ifdef WIN32 +static HANDLE libMutex = NULL; +#else +static int libMutex = -1; +#endif + +void InitLibrary(); +void ExitLibrary(); + +static void libSwprintf(wchar_t *wcs, const wchar_t *lpszFormat, ...) { + va_list args; + va_start(args, lpszFormat); + +#ifdef WIN32 + vswprintf(wcs, lpszFormat, args); +#else + vswprintf(wcs, 255, lpszFormat, args); +#endif + va_end(args); +} + + +#ifdef WIN32 +/* Begin implementation */ +BOOL APIENTRY DllMain(HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved) { + switch (ul_reason_for_call) { + + case DLL_PROCESS_ATTACH: + // InitLibrary(); + break; + case DLL_PROCESS_DETACH: + ExitLibrary(); + break; + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + break; + } + return (TRUE); +} +#elif defined(SOLARIS) + +void so_init(void); +void so_fini(void); +static int os_createmutex(int *semid); +static void os_obtainmutex(int semid); +static void os_releasemutex(int semid); +static void os_destroymutex(int semid); +static IMA_STATUS getSolarisNodeProps(IMA_NODE_PROPERTIES *nodeProps); +static IMA_STATUS getSolarisSharedNodeName(IMA_NODE_NAME name); +static IMA_STATUS getSolarisSharedNodeAlias(IMA_NODE_ALIAS alias); +static IMA_STATUS setSolarisSharedNodeName(const IMA_NODE_NAME name); +static IMA_STATUS setSolarisSharedNodeAlias(const IMA_NODE_ALIAS alias); + +#pragma init(so_init) +#pragma fini(so_fini) + +void so_init() { + InitLibrary(); +} +void so_fini() { + ExitLibrary(); +} + +static IMA_STATUS getSolarisNodeProps(IMA_NODE_PROPERTIES *nodeProps) { + int ret; + int i; + IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; + IMA_GetNodePropertiesFn PassFunc; + IMA_OID nodeOid; + + if (number_of_plugins == -1) + InitLibrary(); + + /* + * See if iscsiadm and ima plugin packages have been installed. + */ + ret = system("pkginfo SUNWima > /dev/null"); + if (ret) { + return (status); + } + + ret = system("pkginfo SUNWiscsir > /dev/null"); + if (ret) { + return (status); + } + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (strstr(plugintable[i].PluginPath, + "libsun_ima.so") == NULL) { + continue; + } + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); + PassFunc = + (IMA_GetNodePropertiesFn) dlsym( + plugintable[i].hPlugin, + "IMA_GetNodeProperties"); + if (PassFunc != NULL) { + status = PassFunc(nodeOid, nodeProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + break; + } + + os_releasemutex(libMutex); + return (status); +} + +static IMA_STATUS getSolarisSharedNodeName(IMA_NODE_NAME name) { + IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; + IMA_NODE_PROPERTIES nodeProps; + + status = getSolarisNodeProps(&nodeProps); + if (status != IMA_STATUS_SUCCESS) { + return (status); + } + bcopy(&nodeProps.name, name, sizeof (IMA_NODE_NAME)); + return (status); +} + +static IMA_STATUS getSolarisSharedNodeAlias(IMA_NODE_ALIAS alias) { + IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; + IMA_NODE_PROPERTIES nodeProps; + + status = getSolarisNodeProps(&nodeProps); + if (status != IMA_STATUS_SUCCESS) { + return (status); + } + bcopy(&nodeProps.alias, alias, sizeof (IMA_NODE_ALIAS)); + return (status); +} + +static IMA_STATUS setSolarisSharedNodeName(const IMA_NODE_NAME name) { + int ret; + int i; + IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; + IMA_NODE_PROPERTIES nodeProps; + IMA_SetNodeNameFn PassFunc; + IMA_OID nodeOid; + + if (number_of_plugins == -1) + InitLibrary(); + + /* + * See if iscsiadm and ima plugin packages have been installed. + */ + ret = system("pkginfo SUNWima > /dev/null"); + if (ret) { + return (status); + } + + ret = system("pkginfo SUNWiscsir > /dev/null"); + if (ret) { + return (status); + } + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (strstr(plugintable[i].PluginPath, + "libsun_ima.so") == NULL) { + continue; + } + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); + PassFunc = + (IMA_SetNodeNameFn) dlsym(plugintable[i].hPlugin, + "IMA_SetNodeName"); + if (PassFunc != NULL) { + status = PassFunc(nodeOid, name); + } + os_releasemutex(plugintable[i].pluginMutex); + } + break; + } + + os_releasemutex(libMutex); + return (status); +} + +static IMA_STATUS setSolarisSharedNodeAlias(const IMA_NODE_ALIAS alias) { + int ret; + int i; + IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; + IMA_NODE_PROPERTIES nodeProps; + IMA_SetNodeAliasFn PassFunc; + IMA_OID nodeOid; + + if (number_of_plugins == -1) + InitLibrary(); + + /* + * See if iscsiadm and ima plugin packages have been installed. + */ + ret = system("pkginfo SUNWima > /dev/null"); + if (ret) { + return (status); + } + + ret = system("pkginfo SUNWiscsir > /dev/null"); + if (ret) { + return (status); + } + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (strstr(plugintable[i].PluginPath, + "libsun_ima.so") == NULL) { + continue; + } + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); + PassFunc = + (IMA_SetNodeAliasFn) dlsym(plugintable[i].hPlugin, + "IMA_SetNodeAlias"); + if (PassFunc != NULL) { + status = PassFunc(nodeOid, alias); + } + os_releasemutex(plugintable[i].pluginMutex); + } + break; + } + + os_releasemutex(libMutex); + return (status); +} + +#else +/* + * add code in .init and .fini, + * "__attribute__ ((constructor))" and "__attribute__ ((destructor))" + * are used with gcc + */ +__attribute__ ((constructor)) void init() { + InitLibrary(); +} + +__attribute__ ((destructor)) void fini() { + ExitLibrary(); +} + +#endif + + +#ifdef WIN32 + +static BOOL os_createmutex(HANDLE Mutex) { + Mutex = CreateMutex(NULL, FALSE, NULL); + + if (Mutex == NULL) { + return (FALSE); + } + + return (TRUE); +} + +static void os_destroymutex(HANDLE Mutex) { + if (Mutex != NULL) { + CloseHandle(Mutex); + } +} + + +static void os_obtainmutex(HANDLE Mutex) { + WaitForSingleObject(Mutex, INFINITE); +} + +static void os_releasemutex(HANDLE Mutex) { + ReleaseMutex(Mutex); +} + +#else +#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) +/* <sys/sem.h> */ +#else +union semun { + int val; /* value for SETVAL */ + struct semid_ds *bf; /* buffer for IPC_STAT, IPC_SET */ + unsigned short int *array; /* array for GETALL, SETALL */ + struct seminfo *__buf; /* buffer for IPC_INFO */ +}; +#endif + +/* Create the semaphore. Return 1 if successful, 0 otherwise */ +static int os_createmutex(int *semid) { + int retVal; + union semun sem_union; + + if (semid == NULL) { + return (0); + } + + retVal = semget(IPC_PRIVATE, 1, IPC_CREAT); + if (retVal == -1) { + return (0); + } + + *semid = retVal; /* save key of created semaphore */ + sem_union.val = 1; /* start semaphore off signaled */ + retVal = semctl(*semid, 0, SETVAL, sem_union); + if (retVal == -1) { + return (0); + } + + return (1); +} + +static void os_obtainmutex(int semid) { + int retVal; + struct sembuf sem_b; + + sem_b.sem_num = 0; + sem_b.sem_op = -1; + sem_b.sem_flg = SEM_UNDO; + retVal = semop(semid, &sem_b, 1); + +} + +static void os_releasemutex(int semid) { + int retVal; + struct sembuf sem_b; + + sem_b.sem_num = 0; + sem_b.sem_op = 1; + sem_b.sem_flg = SEM_UNDO; + retVal = semop(semid, &sem_b, 1); + +} + +/* Destroy the SNMP semaphore. */ +static void os_destroymutex(int semid) { + int retVal; + union semun sem_union; + + retVal = semctl(semid, 0, IPC_RMID, sem_union); + +} +#endif + + +void InitLibrary() { + + FILE *imaconf; + char fullline[512]; /* Full line read in from IMA.conf */ + char pluginname[64]; /* Read in from file IMA.conf */ + char pluginpath[256]; /* Read in from file IMA.conf */ + char imaConfFilePath[256]; + char systemPath[256]; + char *charPtr; + IMA_UINT dwStrLength; + + IMA_UINT i = 0; + + if (number_of_plugins != -1) + return; + + number_of_plugins = 0; + + if (os_createmutex(&libMutex) == 0) { + return; + } + os_obtainmutex(libMutex); + + sharedNodeAlias[0] = 0; + dwStrLength = 255; + + + + /* Open configuration file from known location */ +#ifdef WIN32 + if (GetSystemDirectory(systemPath, sizeof (systemPath))) + sprintf(imaConfFilePath, "%s\\drivers\\etc\\ima.conf", + systemPath); + else + strcpy(imaConfFilePath, "ima.conf"); +#else + strcpy(imaConfFilePath, "/etc/ima.conf"); +#endif + + if ((imaconf = fopen(imaConfFilePath, "r")) == NULL) { + os_releasemutex(libMutex); + return; + } + /* Read in each line and load library */ + while ((imaconf != NULL) && + (fgets(fullline, sizeof (fullline), imaconf))) { + if ((fullline[0] != '#') && (fullline[0] != '\n')) { + /* Take out the '\n' */ + if ((charPtr = (char *)strchr(fullline, '\n')) != NULL) + *charPtr = '\0'; + + /* look for the first tab */ + if ((charPtr = (char *)strchr(fullline, '\t')) == NULL) + charPtr = (char *)strchr(fullline, ' '); + + /* Set Null termination for library name if found */ + if (charPtr != NULL) { + *charPtr++ = '\0'; + /* + * Skip spaces and tabs until + * the next character found + */ + while ((*charPtr == ' ') || (*charPtr == '\t')) + charPtr++; + } + else + continue; /* May be invalid entry */ + + /* Copy library name and path */ + strcpy(pluginname, fullline); + strcpy(pluginpath, charPtr); + + /* + * Continue to the next line if library name or + * path is invalid + */ + if ((strlen(pluginname) == 0) || + (strlen(pluginpath) == 0)) + continue; + +#ifdef WIN32 + /* Load the DLL now */ + plugintable[i].hPlugin = LoadLibrary(pluginpath); +#else + /* Load the DLL now */ + plugintable[i].hPlugin = dlopen(pluginpath, RTLD_LAZY); +#endif + if (plugintable[i].hPlugin != NULL) { + typedef int (*InitializeFn)(); + InitializeFn PassFunc; + IMA_STATUS status; + + memcpy((char *)&plugintable[i].PluginName, + (char *)&pluginname, 64); + memcpy((char *) + &plugintable[i].PluginPath, + (char *)&pluginpath, 256); + plugintable[i].ownerId = i + 1; + +#ifdef WIN32 + PassFunc = (InitializeFn) + GetProcAddress( + plugintable[i].hPlugin, "Initialize"); +#else + PassFunc = (InitializeFn) + dlsym( + plugintable[i].hPlugin, "Initialize"); +#endif + if (PassFunc != NULL) { + status = + PassFunc(plugintable[i].ownerId); + } + + plugintable[i].number_of_vbcallbacks = 0; + plugintable[i].number_of_pccallbacks = 0; + os_createmutex(&(plugintable[i].pluginMutex)); + i++; + } + } + } + number_of_plugins = i; + os_releasemutex(libMutex); +} + + +void ExitLibrary() { + IMA_UINT j; + IMA_UINT i; + + if (number_of_plugins == -1) + return; + + os_obtainmutex(libMutex); + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].hPlugin != NULL) { + TerminateFn ExitPassFunc; + + os_obtainmutex(plugintable[i].pluginMutex); + for (j = 0; j < plugintable[i].number_of_vbcallbacks; + j++) { +#define IMA_DFOBC_STR "IMA_DeregisterForObjectVisibilityChangesFn" + IMA_DeregisterForObjectVisibilityChangesFn + PassFunc; +#ifdef WIN32 + PassFunc = + (IMA_DeregisterForObjectVisibilityChangesFn) + GetProcAddress(plugintable[i].hPlugin, + IMA_DFOBC_STR); +#else + PassFunc = + (IMA_DeregisterForObjectVisibilityChangesFn) + dlsym(plugintable[i].hPlugin, + IMA_DFOBC_STR); +#endif + if (PassFunc != NULL) { + PassFunc(plugintable[i].vbcallback[j]); + } +#undef IMA_DFOBC_STR + } + plugintable[i].number_of_vbcallbacks = 0; + + for (j = 0; j < plugintable[i].number_of_pccallbacks; + j++) { + IMA_DeregisterForObjectPropertyChangesFn + PassFunc; +#ifdef WIN32 + PassFunc = + (IMA_DeregisterForObjectPropertyChangesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_DeregisterForObjectPropertyChangesFn"); +#else + PassFunc = + (IMA_DeregisterForObjectPropertyChangesFn) + dlsym(plugintable[i].hPlugin, + "IMA_DeregisterForObjectPropertyChangesFn"); +#endif + if (PassFunc != NULL) { + PassFunc(plugintable[i].pccallback[j]); + } + } + plugintable[i].number_of_pccallbacks = 0; + +#ifdef WIN32 + ExitPassFunc = + (TerminateFn) GetProcAddress + (plugintable[i].hPlugin, "Terminate"); +#else + ExitPassFunc = (TerminateFn) + dlsym(plugintable[i].hPlugin, "Terminate"); +#endif + if (ExitPassFunc != NULL) { + ExitPassFunc(); + } +#ifdef WIN32 + /* Unload DLL from memory */ + FreeLibrary(plugintable[i].hPlugin); +#else + /* Unload DLL from memory */ + dlclose(plugintable[i].hPlugin); +#endif + os_releasemutex(plugintable[i].pluginMutex); + os_destroymutex(plugintable[i].pluginMutex); + } + } + number_of_plugins = -1; + os_releasemutex(libMutex); + os_destroymutex(libMutex); +} + + +static void VisibilityCallback( + IMA_BOOL becomingVisible, + IMA_OID objectId) { + IMA_UINT i, j; + os_obtainmutex(libMutex); + for (i = 0; i < number_of_plugins; i++) { + if ((plugintable[i].hPlugin != NULL) && + (objectId.ownerId == plugintable[i].ownerId)) { + os_obtainmutex(plugintable[i].pluginMutex); + for (j = 0; + j < plugintable[i].number_of_vbcallbacks; + j++) { + (plugintable[i].vbcallback[j]) + (becomingVisible, objectId); + } + os_releasemutex(plugintable[i].pluginMutex); + } + } + os_releasemutex(libMutex); + +} + +static void PropertyCallback( + IMA_OID objectId) { + IMA_UINT i, j; + + os_obtainmutex(libMutex); + for (i = 0; i < number_of_plugins; i++) { + if ((plugintable[i].hPlugin != NULL) && + (objectId.ownerId == plugintable[i].ownerId)) { + os_obtainmutex(plugintable[i].pluginMutex); + for (j = 0; + j < plugintable[i].number_of_pccallbacks; + j++) { + (plugintable[i].pccallback[j])(objectId); + } + os_releasemutex(plugintable[i].pluginMutex); + } + } + os_releasemutex(libMutex); +} + +/* + * Gets the date and time, in the form of an IMA_DATETIME, from the build + * script when compiled. + */ +static void GetBuildTime(IMA_DATETIME* pdatetime) { + +#ifdef WIN32 + char *dayToken[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; + char *monthToken[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + char monthString[4]; + char dayString[4]; + int i; + + sscanf(__TIME__, "%u:%u:%u", &pdatetime->tm_hour, + &pdatetime->tm_min, &pdatetime->tm_sec); + sscanf(__DATE__, "%s %u %u", monthString, + &pdatetime->tm_mday, &pdatetime->tm_year); + sscanf(__TIMESTAMP__, "%s", dayString); + + pdatetime->tm_year -= 1900; + pdatetime->tm_isdst = -1; + + pdatetime->tm_wday = 0; + for (i = 0; i < 7; i++) { + if (strcmp(dayToken[i], dayString) == 0) { + pdatetime->tm_wday = i; + break; + } + } + + pdatetime->tm_mon = 0; + for (i = 0; i < 12; i++) { + if (strcmp(monthToken[i], monthString) == 0) { + pdatetime->tm_mon = i; + break; + } + } + +#else +#if defined(BUILD_DATE) + if (strptime(BUILD_DATE, "%Y/%m/%d %T %Z", pdatetime) == NULL) { + memset(pdatetime, 0, sizeof (IMA_DATETIME)); + } +#else + memset(pdatetime, 0, sizeof (IMA_DATETIME)); +#endif +#endif + +} + + + +/* + * Gets the properties of the IMA library that is being used. + * + * @param pProps A pointer to an @ref IMA_LIBRARY_PROPERTIES structure + * allocated by the caller. On successful return this structure will + * contain the properties of the IMA library. + * @return An IMA_STATUS indicating if the operation was successful or if + * an error occurred. + * @retval IMA_SUCCESS Returned if the library properties were successfully + * returned. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL or + * specifies a memory area to which data cannot be written. + */ +IMA_API IMA_STATUS IMA_GetLibraryProperties( + IMA_LIBRARY_PROPERTIES *pProps) { + + char imaPath[256]; +#ifdef WIN32 + HMODULE imaHandle; +#endif + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + // Fill in the library properties. + GetBuildTime(&pProps->buildTime); + pProps->supportedImaVersion = LIBRARY_PROPERTY_SUPPORTED_IMA_VERSION; + libSwprintf(pProps->implementationVersion, L"%ls", + LIBRARY_PROPERTY_IMPLEMENTATION_VERSION); + libSwprintf(pProps->vendor, L"%ls", LIBRARY_PROPERTY_VENDOR); + + +#ifdef WIN32 + imaHandle = GetModuleHandleA("ima"); + imaPath[0] = 0; + if (imaHandle != NULL) { + GetModuleFileNameA(imaHandle, imaPath, 256); + } + MultiByteToWideChar(CP_ACP, 0, imaPath, -1, + pProps->fileName, 256); +#else + libSwprintf(pProps->fileName, LIBRARY_FILE_NAME); + + // mbstowcs(pProps->fileName, imaPath, 256); +#endif + + return (IMA_STATUS_SUCCESS); +} + + +/* + * Gets a list of the object IDs of all currently loaded plugins. + * + * @param ppList A pointer to a pointer to an @ref IMA_OID_LIST. + * On successful return this will contain a pointer to an @ref + * IMA_OID_LIST which contains the object IDs of all of the plugins + * currently loaded by the library. + * @return An IMA_STATUS indicating if the operation was successful + * or if an error occurred. + * @retval IMA_SUCCESS Returned if the plugin ID list was successfully + * returned. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or + * specifies a memory area to which data cannot be written. + */ +IMA_API IMA_STATUS IMA_GetPluginOidList( + IMA_OID_LIST **ppList) { + IMA_UINT i; + + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + + *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + + (number_of_plugins - 1) * sizeof (IMA_OID)); + + if ((*ppList) == NULL) + return (IMA_ERROR_UNEXPECTED_OS_ERROR); + + (*ppList)->oidCount = number_of_plugins; + + for (i = 0; i < number_of_plugins; i++) { + + (*ppList)->oids[i].objectType = IMA_OBJECT_TYPE_PLUGIN; + (*ppList)->oids[i].ownerId = plugintable[i].ownerId; + (*ppList)->oids[i].objectSequenceNumber = 0; + + } + os_releasemutex(libMutex); + return (IMA_STATUS_SUCCESS); +} + + + + +/* + * Gets the properties of the specified vendor plugin. + * + * @param pluginId The ID of the plugin whose properties are being retrieved. + * @param pProps A pointer to an @ref IMA_PLUGIN_PROPERTIES structure + * allocated by the caller. On successful return this will contain the + * properties of the plugin specified by pluginId. + * @return An IMA_STATUS indicating if the operation was successful or if + * an error occurred. + * @retval IMA_SUCCESS Returned if the plugin properties were successfully + * returned. + * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a pluginId does not + * specify any valid object type. + * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a pluginId does not + * specify a plugin object. + * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a pluginId refers to a + * plugin, but not one that is currently loaded. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL or + * specify a memory area to which data cannot be written. + */ +IMA_API IMA_STATUS IMA_GetPluginProperties( + IMA_OID pluginOid, + IMA_PLUGIN_PROPERTIES *pProps) { + IMA_GetPluginPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if ((pluginOid.objectType != IMA_OBJECT_TYPE_PLUGIN) || + (pluginOid.objectSequenceNumber != 0)) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == pluginOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetPluginPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetPluginProperties"); +#else + PassFunc = (IMA_GetPluginPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetPluginProperties"); +#endif + if (PassFunc != NULL) { + status = PassFunc(pluginOid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); + +} + + + + +/* + * Gets the object ID for the plugin associated with the specified object ID. + * + * @param objectId The object ID of an object that has been received from + * a previous library call. + * @param pPluginId A pointer to an @ref IMA_OID structure allocated by the + * caller. On successful return this will contain the object ID of the + * plugin associated with the object specified by @a objectId. This + * can then be used to work with the plugin, e.g., to get the + * properties of the plugin or the send the plugin an IOCtl. + * @return An IMA_STATUS indicating if the operation was successful or if + * an error occurred. + * @retval IMA_SUCCESS Returned if the associated plugin ID was + * successfully returned. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pPluginId is NULL + * or specifes a memory area to which data cannot be written. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a objectId specifies + * an object not owned by a plugin, but instead one that is owned by + * the library. + * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a objectId specifies + * an object with an invalid type. + */ +IMA_API IMA_STATUS IMA_GetAssociatedPluginOid( + IMA_OID objectId, + IMA_OID *pPluginId) { + IMA_UINT i; + IMA_STATUS status; + + + if (number_of_plugins == -1) + InitLibrary(); + + if (pPluginId == NULL || objectId.ownerId == RL_LIBRARY_SEQNUM) + return (IMA_ERROR_INVALID_PARAMETER); + + if (objectId.objectType != IMA_OBJECT_TYPE_UNKNOWN && + objectId.objectType != IMA_OBJECT_TYPE_PLUGIN && + objectId.objectType != IMA_OBJECT_TYPE_NODE && + objectId.objectType != IMA_OBJECT_TYPE_LHBA && + objectId.objectType != IMA_OBJECT_TYPE_PHBA && + objectId.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL && + objectId.objectType != IMA_OBJECT_TYPE_PORTAL_GROUP && + objectId.objectType != IMA_OBJECT_TYPE_LNP && + objectId.objectType != IMA_OBJECT_TYPE_PNP && + objectId.objectType != IMA_OBJECT_TYPE_TARGET && + objectId.objectType != IMA_OBJECT_TYPE_LU && + objectId.objectType != IMA_OBJECT_TYPE_DISCOVERY_ADDRESS && + objectId.objectType != IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET) + return (IMA_ERROR_INVALID_OBJECT_TYPE); + + os_obtainmutex(libMutex); + + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + if (objectId.ownerId == plugintable[i].ownerId) { + pPluginId->objectType = IMA_OBJECT_TYPE_PLUGIN; + pPluginId->ownerId = plugintable[i].ownerId; + pPluginId->objectSequenceNumber = 0; + status = IMA_STATUS_SUCCESS; + } + + } + os_releasemutex(libMutex); + return (status); +} + + + + +/* + * Gets the object ID of the shared node. + * + * @param pSharedNodeId A pointer to an @ref IMA_OID structure allocated by + * the caller. On successful return it will contain the object ID of the + * shared node of the currently executing system is placed. + * @return An IMA_STATUS indicating if the operation was successful or if + * an error occurred. + * @retval IMA_SUCCESS Returned if the shared node ID has been successfully + * retrieved. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pSharedNodeId is NULL + * or specifies a memory area to which data cannot be written. + */ +IMA_API IMA_STATUS IMA_GetSharedNodeOid( + IMA_OID *pSharedNodeId) { + if (pSharedNodeId == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + pSharedNodeId->objectType = IMA_OBJECT_TYPE_NODE; + pSharedNodeId->ownerId = RL_LIBRARY_SEQNUM; + pSharedNodeId->objectSequenceNumber = RL_SHARED_NODE_SEQNUM; + return (IMA_STATUS_SUCCESS); +} + + +IMA_API IMA_STATUS IMA_GetObjectType( + IMA_OID oid, + IMA_OBJECT_TYPE *pObjectType) { + IMA_STATUS status; + IMA_UINT i; + + if (pObjectType == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (oid.objectType != IMA_OBJECT_TYPE_UNKNOWN && + oid.objectType != IMA_OBJECT_TYPE_PLUGIN && + oid.objectType != IMA_OBJECT_TYPE_NODE && + oid.objectType != IMA_OBJECT_TYPE_LHBA && + oid.objectType != IMA_OBJECT_TYPE_PHBA && + oid.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL && + oid.objectType != IMA_OBJECT_TYPE_PORTAL_GROUP && + oid.objectType != IMA_OBJECT_TYPE_LNP && + oid.objectType != IMA_OBJECT_TYPE_PNP && + oid.objectType != IMA_OBJECT_TYPE_TARGET && + oid.objectType != IMA_OBJECT_TYPE_LU && + oid.objectType != IMA_OBJECT_TYPE_DISCOVERY_ADDRESS && + oid.objectType != IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET) + return (IMA_ERROR_INVALID_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + *pObjectType = oid.objectType; + status = IMA_STATUS_SUCCESS; + } + } + os_releasemutex(libMutex); + return (status); +} + + + +/* + * Gets the properties of the specified iSCSI node. + * @param nodeId The ID of the node to get the properties of. + * @param pProps A pointer to an @ref IMA_NODE_PROPERTIES structure + * which on successfully return + * will contain the properties of the specified node. + * @return An IMA_STATUS indicating if the operation was successful or + * if an error occurred. + * @retval IMA_SUCCESS Returned if the node properties have been + * successfully retrieved. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL + * or specifies a memory area to which data cannot be written. + * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a nodeId does + * not specify any valid object type. + * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a nodeId does + * not specify a node object. + * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a nodeId does not + * specify a node which is currently known to the system. + */ +IMA_API IMA_STATUS IMA_GetNodeProperties( + IMA_OID nodeOid, + IMA_NODE_PROPERTIES *pProps) { + IMA_GetNodePropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + char fullline[512]; /* Full line read in from IMA.conf */ + char nodename[256]; + IMA_UINT dwStrLength; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (nodeOid.objectType != IMA_OBJECT_TYPE_NODE) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + if ((nodeOid.ownerId == RL_LIBRARY_SEQNUM) && + (nodeOid.objectSequenceNumber == RL_SHARED_NODE_SEQNUM)) { + pProps->runningInInitiatorMode = IMA_TRUE; + pProps->runningInTargetMode = IMA_TRUE; + pProps->nameAndAliasSettable = IMA_TRUE; + + if (sharedNodeName[0] == 0) { +#if defined(_WINDOWS) + GetComputerName((char *)fullline, + (LPDWORD)&dwStrLength); + sprintf(nodename, DEFAULT_NODE_NAME_FORMAT, fullline); + MultiByteToWideChar(CP_ACP, 0, nodename, -1, + sharedNodeName, 256); +#elif defined(SOLARIS) + + if (getSolarisSharedNodeName(sharedNodeName) != + IMA_STATUS_SUCCESS) { + gethostname((char *)fullline, &dwStrLength); + sprintf(nodename, + DEFAULT_NODE_NAME_FORMAT, fullline); + mbstowcs(sharedNodeName, nodename, 256); + } +#else + gethostname((char *)fullline, &dwStrLength); + sprintf(nodename, DEFAULT_NODE_NAME_FORMAT, fullline); + mbstowcs(sharedNodeName, nodename, 256); +#endif + } + + if (sharedNodeName[0] != 0) { + libSwprintf(pProps->name, L"%ls", sharedNodeName); + pProps->nameValid = IMA_TRUE; + } + else + pProps->nameValid = IMA_FALSE; + +#if defined(SOLARIS) + if (sharedNodeAlias[0] == 0) { + getSolarisSharedNodeAlias(sharedNodeAlias); + } +#endif + + if (sharedNodeAlias[0] != 0) { + libSwprintf(pProps->alias, L"%ls", sharedNodeAlias); + pProps->aliasValid = IMA_TRUE; + } + else + pProps->aliasValid = IMA_FALSE; + + return (IMA_STATUS_SUCCESS); + } + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == nodeOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetNodePropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetNodeProperties"); +#else + PassFunc = (IMA_GetNodePropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetNodeProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(nodeOid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); + +} + + + + +/* + * Sets the name of the specified node. + * + * @param nodeId The object ID of the node whose name is being set. + * @param newName The new name of the node. + * @return An IMA_STATUS indicating if the operation was successful or if + * an error occurred. + * @retval IMA_SUCCESS Returned if the node name was successfully changed. + * @retval IMA_STATUS_REBOOT_NECESSARY Returned if a reboot is necessary + * before the setting of the name actually takes affect. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a newname is NULL, or + * specifies a memory area to which data cannot be written, or has a + * length of 0. + * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a nodeId does not + * specify any valid object type. + * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a nodeId does not + * specify a node object. + * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a nodeId does not specify a + * node which is currently known to the system. + * @retval IMA_ERROR_NAME_TOO_LONG Returned if @a newName contains too many + * characters. + */ +IMA_API IMA_STATUS IMA_SetNodeName( + IMA_OID nodeOid, + const IMA_NODE_NAME newName) { + IMA_SetNodeNameFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (newName == NULL || wcslen(newName) == 0) + return (IMA_ERROR_INVALID_PARAMETER); + + if (wcslen(newName) > IMA_NODE_NAME_LEN - 1) + return (IMA_ERROR_NAME_TOO_LONG); + + if (nodeOid.objectType != IMA_OBJECT_TYPE_NODE) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + if ((nodeOid.ownerId == RL_LIBRARY_SEQNUM) && + (nodeOid.objectSequenceNumber == RL_SHARED_NODE_SEQNUM)) { +#if defined(SOLARIS) + if (setSolarisSharedNodeName(newName) != IMA_STATUS_SUCCESS) { + return (IMA_ERROR_UNKNOWN_ERROR); + } +#endif + os_obtainmutex(libMutex); + libSwprintf(sharedNodeName, L"%ls", newName); + os_releasemutex(libMutex); + return (IMA_STATUS_SUCCESS); + } + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == nodeOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetNodeNameFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetNodeName"); +#else + PassFunc = (IMA_SetNodeNameFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetNodeName"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(nodeOid, newName); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); + +} + + + + +/* + * Generates an unique node name for the currently running system. + * + * @param generatedname On successful return contains the generated node + * name. + * @return An IMA_STATUS indicating if the operation was successful or if + * an error occurred. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a generatedname is NULL + * or specifies a memory area to which data cannot be written. + */ +IMA_API IMA_STATUS IMA_GenerateNodeName( + IMA_NODE_NAME generatedname) { + char computername[256]; + char nodename[256]; + IMA_UINT dwStrLength; +#ifndef _WINDOWS +#ifndef SOLARIS + int i; +#endif +#endif + + dwStrLength = 255; + + if (generatedname == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + +#if defined(_WINDOWS) + GetComputerName((char *)computername, (LPDWORD)&dwStrLength); + _strlwr(computername); + _snprintf(nodename, 256, DEFAULT_NODE_NAME_FORMAT, computername); + MultiByteToWideChar(CP_ACP, 0, nodename, -1, + generatedname, 256); +#elif defined(SOLARIS) + if (getSolarisSharedNodeName(generatedname) != IMA_STATUS_SUCCESS) { + gethostname(computername, &dwStrLength); + sprintf(nodename, DEFAULT_NODE_NAME_FORMAT, generatedname); + mbstowcs(generatedname, nodename, 256); + } +#else + gethostname((char *)computername, &dwStrLength); + i = 0; + while (computername[i] != '\0') { + computername[i] = tolower(computername[i]); + i++; + } + snprintf(nodename, 256, DEFAULT_NODE_NAME_FORMAT, computername); + mbstowcs(generatedname, nodename, 256); +#endif + + return (IMA_STATUS_SUCCESS); +} + + +/* + * Sets the alias of the specified node. + * + * @param nodeId The object ID of the node whose alias is being set. + * @param newAlias A pointer to a Unicode string which contains the new node + * alias.If this parameter is NULL then the current alias is deleted, in + * which case the specified node no longer has an alias. + * @return An IMA_STATUS indicating if the operation was successful or if + * an error occurred. + * @retval IMA_SUCCESS Returned if the node's alias has been successfully set. + * @retval IMA_STATUS_REBOOT_NECESSARY A reboot is necessary before + * the setting of the + * alias actually takes affect. + * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a nodeId does not + * specify any valid object type. + * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a nodeId does not + * specify a node object. + * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a nodeId does not specify + * a node which is currently known to the system. + * @retval IMA_ERROR_NAME_TOO_LONG Returned if @a newAlias contains too many + * characters. + */ +IMA_API IMA_STATUS IMA_SetNodeAlias( + IMA_OID nodeOid, + const IMA_NODE_ALIAS newAlias) { + IMA_SetNodeAliasFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (newAlias == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (wcslen(newAlias) > IMA_NODE_ALIAS_LEN - 1) + return (IMA_ERROR_NAME_TOO_LONG); + + if (nodeOid.objectType != IMA_OBJECT_TYPE_NODE) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + if ((nodeOid.ownerId == RL_LIBRARY_SEQNUM) && + (nodeOid.objectSequenceNumber == RL_SHARED_NODE_SEQNUM)) { +#if defined(SOLARIS) + if (setSolarisSharedNodeAlias(newAlias) != IMA_STATUS_SUCCESS) { + return (IMA_ERROR_UNKNOWN_ERROR); + } +#endif + os_obtainmutex(libMutex); + if (wcslen(newAlias) > 0 && newAlias != NULL) + libSwprintf(sharedNodeAlias, L"%ls", newAlias); + else + libSwprintf(sharedNodeAlias, L"%ls", ""); + + os_releasemutex(libMutex); + return (IMA_STATUS_SUCCESS); + } + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == nodeOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetNodeAliasFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetNodeAlias"); +#else + PassFunc = (IMA_SetNodeAliasFn) + dlsym( + plugintable[i].hPlugin, + "IMA_SetNodeAlias"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(nodeOid, newAlias); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + + + +/* + * Gets a list of the object IDs of all the logical HBAs in the system. + * + * @param ppList A pointer to a pointer to an @ref IMA_OID_LIST structure. + * on successful return this will contain a pointer to an + * @ref IMA_OID_LIST which contains the object IDs of all of the + * LHBAs currently in the system. + * @return An IMA_STATUS indicating if the operation was successful or if + * an error occurred. + * @retval IMA_SUCCESS Returned if the LHBA ID list has been successfully + * returned. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or + * specifies a + * memory area to which data cannot be written. + */ +IMA_API IMA_STATUS IMA_GetLhbaOidList( + IMA_OID_LIST **ppList) { + IMA_GetLhbaOidListFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + + IMA_UINT i; + IMA_UINT j; + IMA_UINT totalIdCount; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + // Get total id count first + totalIdCount = 0; + + for (i = 0; i < number_of_plugins; i++) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetLhbaOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetLhbaOidList"); +#else + PassFunc = (IMA_GetLhbaOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetLhbaOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(&ppOidList); + if (status == IMA_STATUS_SUCCESS) { + totalIdCount += ppOidList->oidCount; +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym(plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + break; + } + } + + + *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + + (totalIdCount - 1) * sizeof (IMA_OID)); + + if ((*ppList) == NULL) { + os_releasemutex(libMutex); + return (IMA_ERROR_UNEXPECTED_OS_ERROR); + } + (*ppList)->oidCount = totalIdCount; + + // 2nd pass to copy the id lists + totalIdCount = 0; + status = IMA_STATUS_SUCCESS; + for (i = 0; i < number_of_plugins; i++) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetLhbaOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetLhbaOidList"); +#else + PassFunc = (IMA_GetLhbaOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetLhbaOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(&ppOidList); + if (status == IMA_STATUS_SUCCESS) { + for (j = 0; + (j < ppOidList->oidCount) && + (totalIdCount < + (*ppList)->oidCount); + j++) { + (*ppList)->oids[totalIdCount]. + objectType + = ppOidList->oids[j]. + objectType; + (*ppList)->oids[totalIdCount]. + objectSequenceNumber = + ppOidList->oids[j]. + objectSequenceNumber; + (*ppList)->oids[totalIdCount]. + ownerId = + ppOidList->oids[j].ownerId; + totalIdCount++; + } +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym(plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + free(*ppList); + break; + } + + } + os_releasemutex(libMutex); + return (status); +} + + + + +/* + * Gets the properties of the specified logical HBA. + * + * @param lhbaId The object ID of the LHBA whose properties are being + * retrieved. + * @param pProps A pointer to an @ref IMA_LHBA_PROPERTIES structure. + * On successful + * return this will contain the properties of the LHBA specified by + * @a lhbaId. + * @return An IMA_STATUS indicating if the operation was successful or if + * an error occurred. + * @retval IMA_SUCCESS Returned if the properties of the specified LHBA + * have been successfully retrieved. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL or + * specify a memory area to which data cannot be written. + * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a lhbaId does not + * specify any valid object type. + * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a lhbaId does not + * specify a LHBA. + * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a lhbaId does not + * specify a LHBA which is currently known to the system. + */ +IMA_API IMA_STATUS IMA_GetLhbaProperties( + IMA_OID lhbaId, + IMA_LHBA_PROPERTIES *pProps) { + IMA_GetLhbaPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetLhbaPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetLhbaProperties"); +#else + PassFunc = (IMA_GetLhbaPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetLhbaProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(lhbaId, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + + + +/* + * Gets a list of the object IDs of all the physical HBAs in the system. + * + * @param ppList A pointer to a pointer to an @ref IMA_OID_LIST structure. + * on successful return this will contain a pointer to an + * @ref IMA_OID_LIST which contains the object IDs of all of the + * PHBAs currently in the system. + * @return An IMA_STATUS indicating if the operation was successful or if + * an error occurred. + * @retval IMA_SUCCESS Returned if the PHBA ID list has been successfully + * returned. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or + * specify a memory area to which data cannot be written. + * @retval IMA_SUCCESS Returned if the properties of the specified PHBA + * have been successfully retrieved. + * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a phbaId does not + * specify a PHBA which is currently known to the system. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or + * specify a memory area to which data cannot be written. + */ +IMA_API IMA_STATUS IMA_GetPhbaOidList( + IMA_OID_LIST **ppList) { + IMA_GetPhbaOidListFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + + IMA_UINT i; + IMA_UINT j; + IMA_UINT totalIdCount; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + // Get total id count first + totalIdCount = 0; + + for (i = 0; i < number_of_plugins; i++) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetPhbaOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetPhbaOidList"); +#else + PassFunc = (IMA_GetPhbaOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetPhbaOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(&ppOidList); + if (status == IMA_STATUS_SUCCESS) { + totalIdCount += ppOidList->oidCount; +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym(plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + break; + } + + } + + + *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + + (totalIdCount - 1) * sizeof (IMA_OID)); + + if ((*ppList) == NULL) { + os_releasemutex(libMutex); + return (IMA_ERROR_UNEXPECTED_OS_ERROR); + } + + (*ppList)->oidCount = totalIdCount; + + // 2nd pass to copy the id lists + totalIdCount = 0; + status = IMA_STATUS_SUCCESS; + for (i = 0; i < number_of_plugins; i++) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetPhbaOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetPhbaOidList"); +#else + PassFunc = (IMA_GetPhbaOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetPhbaOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(&ppOidList); + if (status == IMA_STATUS_SUCCESS) { + for (j = 0; + (j < ppOidList->oidCount) && + (totalIdCount < + (*ppList)->oidCount); + j++) { + (*ppList)->oids[totalIdCount]. + objectType = + ppOidList->oids[j]. + objectType; + (*ppList)->oids[totalIdCount]. + objectSequenceNumber = + ppOidList->oids[j]. + objectSequenceNumber; + (*ppList)->oids[totalIdCount]. + ownerId = + ppOidList->oids[j].ownerId; + totalIdCount++; + } +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress + (plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym(plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + free(*ppList); + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +/* + * Gets the general properties of a physical HBA. + * + * @param phbaId The object ID of the PHBA whose + * properties are being queried. + * @param pProps A pointer to an @ref + * IMA_PHBA_PROPERTIES structure. On successful + * return this will contain the properties of + * the PHBA specified by @a phbaId. + * @return An IMA_STATUS indicating if the + * operation was successful or if an error + * occurred. + * @retval IMA_SUCCESS Returned if the properties + * of the specified PHBA have been + * successfully retrieved. + * @retval IMA_ERROR_INVALID_PARAMETER Returned + * if @a pProps is NULL or specifies a + * memory area to which data cannot be written. + * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned + * if @a phbaId does not specify any + * valid object type. + * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned + * if @a phbaId does not specify a + * PHBA. + * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned + * if @a phbaId does not specify a PHBA + * which is currently known to the system. + */ +IMA_API IMA_STATUS IMA_GetPhbaProperties( + IMA_OID phbaId, + IMA_PHBA_PROPERTIES *pProps) { + IMA_GetPhbaPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == phbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetPhbaPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetPhbaProperties"); +#else + PassFunc = (IMA_GetPhbaPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetPhbaProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(phbaId, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +/* + * Frees a previously allocated IMA_OID_LIST structure. + * + * @param pList A pointer to an @ref IMA_OID_LIST + * structure allocated by the + * library. On successful return the memory + * allocated by the list is freed. + * @return An IMA_STATUS indicating if the operation + * was successful or if an error occurred. + * @retval IMA_SUCCESS Returned if the specified object + * ID list was successfully freed. + * @retval IMA_ERROR_INVALID_PARAMETER Returned + * if @a pList is NULL or specifies a + * memory area from which data cannot be read. + */ +IMA_API IMA_STATUS IMA_FreeMemory( + void *pMemory) { + if (pMemory == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + free(pMemory); + return (IMA_STATUS_SUCCESS); +} + + + + +IMA_API IMA_STATUS IMA_GetNonSharedNodeOidList( + IMA_OID_LIST **ppList) { + IMA_GetNonSharedNodeOidListFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + + IMA_UINT i; + IMA_UINT j; + IMA_UINT totalIdCount; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + // Get total id count first + totalIdCount = 0; + + for (i = 0; i < number_of_plugins; i++) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetNonSharedNodeOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetNonSharedNodeOidList"); +#else + PassFunc = (IMA_GetNonSharedNodeOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetNonSharedNodeOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(&ppOidList); + if (status == IMA_STATUS_SUCCESS) { + totalIdCount += ppOidList->oidCount; +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym(plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + break; + } + + } + + *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + + (totalIdCount - 1) * sizeof (IMA_OID)); + + if ((*ppList) == NULL) { + os_releasemutex(libMutex); + return (IMA_ERROR_UNEXPECTED_OS_ERROR); + } + + (*ppList)->oidCount = totalIdCount; + + // 2nd pass to copy the id lists + totalIdCount = 0; + status = IMA_STATUS_SUCCESS; + for (i = 0; i < number_of_plugins; i++) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetNonSharedNodeOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetNonSharedNodeOidList"); +#else + PassFunc = (IMA_GetNonSharedNodeOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetNonSharedNodeOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(&ppOidList); + if (status == IMA_STATUS_SUCCESS) { + for (j = 0; + (j < ppOidList->oidCount) && + (totalIdCount < ( + *ppList)->oidCount); + j++) { + (*ppList)->oids[ + totalIdCount].objectType = + ppOidList->oids[j]. + objectType; + (*ppList)->oids[totalIdCount]. + objectSequenceNumber = + ppOidList->oids[j]. + objectSequenceNumber; + (*ppList)->oids[ + totalIdCount]. + ownerId = + ppOidList->oids[j]. + ownerId; + totalIdCount++; + } +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym(plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + free(*ppList); + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + + +/* + * Gets the first burst length properties of + * the specified logical HBA. + * + * @param lhbaId The object ID of the logical HBA + * to get the first burst length + * properties of. + * @param pProps A pointer to a min/max values + * structure. + * @return An IMA_STATUS indicating if the operation + * was successful or if an error + * occurred. + * @retval IMA_SUCCESS Returned if the first burst + * length properties have been + * successfully retrieved. + * @retval IMA_ERROR_INVALID_PARAMETER Returned + * if @a pProps is NULL or specifies a + * memory area to which data cannot be written. + * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned + * if @a lhbaId does not specify any + * valid object type. + * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned + * if @a lhbaId does not specify a LHBA. + * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned + * @a lhbaId does not specify a LHBA + * which is currently known to the system. + */ +IMA_API IMA_STATUS IMA_GetFirstBurstLengthProperties( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps) { + IMA_GetFirstBurstLengthPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetFirstBurstLengthPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetFirstBurstLengthProperties"); +#else + PassFunc = + (IMA_GetFirstBurstLengthPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetFirstBurstLengthProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(Oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +/* + * Gets the max burst length properties of the + * specified logical HBA. + * + * @param lhbaId The object ID of the logical HBA to + * get the max burst length properties of. + * @param pProps A pointer to an @ref IMA_MIN_MAX_VALUE + * structure allocated by the + * caller. On successful return this structure + * will contain the max + * burst length properties of this LHBA. + * @return An IMA_STATUS indicating if the operation + * was successful or if an error occurred. + * @retval IMA_SUCCESS Returned if the max burst + * length properties have been + * successfully retrieved. + * @retval IMA_ERROR_INVALID_PARAMETER Returned + * if @a pProps is NULL or specifies a + * memory area to which data cannot be written. + * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned + * if @a lhbaId does not specify any + * valid object type. + * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned + * if @a lhbaId does not specify a HBA. + * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned + * if @a lhbaId does not specify a LHBA + * which is currently known to the system. + */ +IMA_API IMA_STATUS IMA_GetMaxBurstLengthProperties( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps) { + IMA_GetMaxBurstLengthPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetMaxBurstLengthPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetMaxBurstLengthProperties"); +#else + PassFunc = + (IMA_GetMaxBurstLengthPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetMaxBurstLengthProperties"); +#endif + if (PassFunc != NULL) { + status = PassFunc(Oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +/* + * Gets the maximum receive data segment length properties + * of the specified logical HBA. + * + * @param lhbaId The object ID of the logical HBA to + * get the max receive data + * segment length properties of. + * @param pProps A pointer to an @ref IMA_MIN_MAX_VALUE + * structure allocated by the caller. + * On successful return this structure will contain the max + * receive data segment length properties of this LHBA. + * @return An IMA_STATUS indicating if the operation + * was successful or if an error occurred. + * @retval IMA_SUCCESS Returned if the max receive + * data segment length properties + * have been successfully retrieved. + * @retval IMA_ERROR_INVALID_PARAMETER Returned if + * @a pProps is NULL or specifies a + * memory area to which data cannot be written. + * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if + * @a lhbaId does not specify any + * valid object type. + * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if + * a lhbaId does not specify a LHBA. + * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a + * lhbaId does not specify a LHBA + * which is currently known to the system. + */ +IMA_API IMA_STATUS IMA_GetMaxRecvDataSegmentLengthProperties( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps) { + IMA_GetMaxRecvDataSegmentLengthPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; +#define IMA_GMRDSLPFN IMA_GetMaxRecvDataSegmentLengthPropertiesFn +#define IMA_GMRDSLP "IMA_GetMaxRecvDataSegmentLengthProperties" + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GMRDSLPFN) + GetProcAddress(plugintable[i].hPlugin, + IMA_GMRDSLP); +#else + PassFunc = + (IMA_GMRDSLPFN) + dlsym(plugintable[i].hPlugin, + IMA_GMRDSLP); +#endif + + if (PassFunc != NULL) { + status = PassFunc(Oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); +#undef IMA_GMRDSLPFN +#undef IMA_GMRDSLP + return (status); +} + + + +/* --------------------------------------------- */ +IMA_API IMA_STATUS IMA_PluginIOCtl( + IMA_OID pluginOid, + IMA_UINT command, + const void *pInputBuffer, + IMA_UINT inputBufferLength, + void *pOutputBuffer, + IMA_UINT *pOutputBufferLength) { + IMA_PluginIOCtlFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pInputBuffer == NULL || inputBufferLength == 0 || + pOutputBuffer == NULL || pOutputBufferLength == NULL || + *pOutputBufferLength == 0) + return (IMA_ERROR_INVALID_PARAMETER); + + if (pluginOid.objectType != IMA_OBJECT_TYPE_PLUGIN) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == pluginOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_PluginIOCtlFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_PluginIOCtl"); +#else + PassFunc = (IMA_PluginIOCtlFn) + dlsym(plugintable[i].hPlugin, + "IMA_PluginIOCtl"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + pluginOid, command, + pInputBuffer, inputBufferLength, + pOutputBuffer, pOutputBufferLength); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + + + +IMA_API IMA_STATUS IMA_GetNetworkPortalOidList( + IMA_OID lnpId, + IMA_OID_LIST **ppList) { + IMA_GetNetworkPortalOidListFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (lnpId.objectType != IMA_OBJECT_TYPE_LNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lnpId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetNetworkPortalOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetNetworkPortalOidList"); +#else + PassFunc = (IMA_GetNetworkPortalOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetNetworkPortalOidList"); +#endif + + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + IMA_UINT listSize; + listSize = sizeof (IMA_OID_LIST); + status = PassFunc(lnpId, &ppOidList); + if (IMA_SUCCESS(status)) { + + *ppList = (IMA_OID_LIST*) + calloc(1, + sizeof (IMA_OID_LIST) + + (ppOidList-> + oidCount - 1)* + sizeof (IMA_OID)); + + if ((*ppList) == NULL) { + return (EUOS_ERROR); + } + else + memcpy((*ppList), + ppOidList, + listSize + + (ppOidList-> + oidCount - 1)* + sizeof (IMA_OID)); +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetFirstBurstLength( + IMA_OID lhbaId, + IMA_UINT firstBurstLength) { + IMA_SetFirstBurstLengthFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && + lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetFirstBurstLengthFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetFirstBurstLength"); +#else + PassFunc = (IMA_SetFirstBurstLengthFn) + dlsym( + plugintable[i].hPlugin, + "IMA_SetFirstBurstLength"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + lhbaId, firstBurstLength); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetMaxBurstLength( + IMA_OID lhbaId, + IMA_UINT maxBurstLength) { + IMA_SetMaxBurstLengthFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && + lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetMaxBurstLengthFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetMaxBurstLength"); +#else + PassFunc = (IMA_SetMaxBurstLengthFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetMaxBurstLength"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + lhbaId, maxBurstLength); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetMaxRecvDataSegmentLength( + IMA_OID lhbaId, + IMA_UINT maxRecvDataSegmentLength) { + IMA_SetMaxRecvDataSegmentLengthFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && + lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetMaxRecvDataSegmentLengthFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetMaxRecvDataSegmentLength"); +#else + PassFunc = + (IMA_SetMaxRecvDataSegmentLengthFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetMaxRecvDataSegmentLength"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + lhbaId, + maxRecvDataSegmentLength); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetMaxConnectionsProperties( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps) { + IMA_GetMaxConnectionsPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetMaxConnectionsPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetMaxConnectionsProperties"); +#else + PassFunc = + (IMA_GetMaxConnectionsPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetMaxConnectionsProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(Oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetMaxConnections( + IMA_OID lhbaId, + IMA_UINT maxConnections) { + IMA_SetMaxConnectionsFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && + lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetMaxConnectionsFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetMaxConnections"); +#else + PassFunc = (IMA_SetMaxConnectionsFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetMaxConnections"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + lhbaId, maxConnections); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetDefaultTime2RetainProperties( + IMA_OID lhbaId, + IMA_MIN_MAX_VALUE *pProps) { + IMA_GetDefaultTime2RetainPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && + lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetDefaultTime2RetainPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetDefaultTime2RetainProperties"); +#else + PassFunc = + (IMA_GetDefaultTime2RetainPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetDefaultTime2RetainProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(lhbaId, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetDefaultTime2Retain( + IMA_OID lhbaId, + IMA_UINT defaultTime2Retain) { + IMA_SetDefaultTime2RetainFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && + lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetDefaultTime2RetainFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetDefaultTime2Retain"); +#else + PassFunc = + (IMA_SetDefaultTime2RetainFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetDefaultTime2Retain"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + lhbaId, defaultTime2Retain); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetDefaultTime2WaitProperties( + IMA_OID lhbaId, + IMA_MIN_MAX_VALUE *pProps) { + IMA_GetDefaultTime2WaitPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && + lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetDefaultTime2WaitPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetDefaultTime2WaitProperties"); +#else + PassFunc = + (IMA_GetDefaultTime2WaitPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetDefaultTime2WaitProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(lhbaId, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetDefaultTime2Wait( + IMA_OID lhbaId, + IMA_UINT defaultTime2Wait) { + IMA_SetDefaultTime2WaitFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && + lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetDefaultTime2WaitFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetDefaultTime2Wait"); +#else + PassFunc = + (IMA_SetDefaultTime2WaitFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetDefaultTime2Wait"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + lhbaId, defaultTime2Wait); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetMaxOutstandingR2TProperties( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps) { + IMA_GetMaxOutstandingR2TPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetMaxOutstandingR2TPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetMaxOutstandingR2TProperties"); +#else + PassFunc = + (IMA_GetMaxOutstandingR2TPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetMaxOutstandingR2TProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(Oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetMaxOutstandingR2T( + IMA_OID lhbaId, + IMA_UINT maxOutstandingR2T) { + IMA_SetMaxOutstandingR2TFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && + lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetMaxOutstandingR2TFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetMaxOutstandingR2T"); +#else + PassFunc = + (IMA_SetMaxOutstandingR2TFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetMaxOutstandingR2T"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + lhbaId, maxOutstandingR2T); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetErrorRecoveryLevelProperties( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps) { + IMA_GetMaxOutstandingR2TPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetErrorRecoveryLevelPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetErrorRecoveryLevelProperties"); +#else + PassFunc = + (IMA_GetErrorRecoveryLevelPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetErrorRecoveryLevelProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(Oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetErrorRecoveryLevel( + IMA_OID Oid, + IMA_UINT errorRecoveryLevel) { + IMA_SetErrorRecoveryLevelFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetErrorRecoveryLevelFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetErrorRecoveryLevel"); +#else + PassFunc = + (IMA_SetErrorRecoveryLevelFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetErrorRecoveryLevel"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + Oid, errorRecoveryLevel); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetInitialR2TProperties( + IMA_OID Oid, + IMA_BOOL_VALUE *pProps) { + IMA_GetInitialR2TPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetInitialR2TPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetInitialR2TProperties"); +#else + PassFunc = + (IMA_GetInitialR2TPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetInitialR2TProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(Oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetInitialR2T( + IMA_OID Oid, + IMA_BOOL initialR2T) +{ + IMA_SetInitialR2TFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (initialR2T != IMA_TRUE && + initialR2T != IMA_FALSE) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetInitialR2TFn) GetProcAddress( + plugintable[i].hPlugin, + "IMA_SetInitialR2T"); +#else + PassFunc = + (IMA_SetInitialR2TFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetInitialR2T"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(Oid, initialR2T); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetImmediateDataProperties( + IMA_OID Oid, + IMA_BOOL_VALUE *pProps) { + IMA_GetImmediateDataPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetImmediateDataPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetImmediateDataProperties"); +#else + PassFunc = + (IMA_GetImmediateDataPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetImmediateDataProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(Oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetImmediateData( + IMA_OID Oid, + IMA_BOOL immediateData) { + IMA_SetImmediateDataFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (immediateData != IMA_TRUE && + immediateData != IMA_FALSE) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetImmediateDataFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetImmediateData"); +#else + PassFunc = + (IMA_SetImmediateDataFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetImmediateData"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(Oid, immediateData); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetDataPduInOrderProperties( + IMA_OID Oid, + IMA_BOOL_VALUE *pProps) { + IMA_GetDataPduInOrderPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetDataPduInOrderPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetDataPduInOrderProperties"); +#else + PassFunc = + (IMA_GetDataPduInOrderPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetDataPduInOrderProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(Oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetDataPduInOrder( + IMA_OID Oid, + IMA_BOOL dataPduInOrder) { + IMA_SetDataPduInOrderFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (dataPduInOrder != IMA_TRUE && + dataPduInOrder != IMA_FALSE) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetDataPduInOrderFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetDataPduInOrder"); +#else + PassFunc = + (IMA_SetDataPduInOrderFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetDataPduInOrder"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(Oid, dataPduInOrder); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetDataSequenceInOrderProperties( + IMA_OID Oid, + IMA_BOOL_VALUE *pProps) { + IMA_GetDataSequenceInOrderPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetDataSequenceInOrderPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetDataSequenceInOrderProperties"); +#else + PassFunc = + (IMA_GetDataSequenceInOrderPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetDataSequenceInOrderProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(Oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetDataSequenceInOrder( + IMA_OID Oid, + IMA_BOOL dataSequenceInOrder) { + IMA_SetDataSequenceInOrderFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (dataSequenceInOrder != IMA_TRUE && + dataSequenceInOrder != IMA_FALSE) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetDataSequenceInOrderFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetDataSequenceInOrder"); +#else + PassFunc = + (IMA_SetDataSequenceInOrderFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetDataSequenceInOrder"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + Oid, dataSequenceInOrder); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetStatisticsCollection( + IMA_OID Oid, + IMA_BOOL enableStatisticsCollection) { + IMA_SetStatisticsCollectionFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (enableStatisticsCollection != IMA_TRUE && + enableStatisticsCollection != IMA_FALSE) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_PHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetStatisticsCollectionFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetStatisticsCollection"); +#else + PassFunc = + (IMA_SetStatisticsCollectionFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetStatisticsCollection"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + Oid, enableStatisticsCollection); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetNetworkPortStatus( + IMA_OID portOid, + IMA_NETWORK_PORT_STATUS *pStatus) { + IMA_GetNetworkPortStatusFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pStatus == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (portOid.objectType != IMA_OBJECT_TYPE_PNP && + portOid.objectType != IMA_OBJECT_TYPE_LNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == portOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetNetworkPortStatusFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetNetworkPortStatus"); +#else + PassFunc = + (IMA_GetNetworkPortStatusFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetNetworkPortStatus"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(portOid, pStatus); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetTargetOidList( + IMA_OID Oid, + IMA_OID_LIST **ppList) { + IMA_GetTargetOidListFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_LNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetTargetOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetTargetOidList"); +#else + PassFunc = + (IMA_GetTargetOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetTargetOidList"); +#endif + + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + IMA_UINT listSize; + listSize = sizeof (IMA_OID_LIST); + status = PassFunc(Oid, &ppOidList); + if (IMA_SUCCESS(status)) { + *ppList = + (IMA_OID_LIST*)calloc(1, + sizeof (IMA_OID_LIST) + + ((ppOidList->oidCount - 1)* + sizeof (IMA_OID))); + + if ((*ppList) == NULL) { + return (EUOS_ERROR); + } + else + memcpy((*ppList), + ppOidList, listSize + + (ppOidList-> + oidCount - 1)* + sizeof (IMA_OID)); +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_RemoveStaleData( + IMA_OID lhbaId) { + IMA_RemoveStaleDataFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_RemoveStaleDataFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_RemoveStaleData"); +#else + PassFunc = (IMA_RemoveStaleDataFn) + dlsym(plugintable[i].hPlugin, + "IMA_RemoveStaleData"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(lhbaId); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetIsnsDiscovery( + IMA_OID phbaId, + IMA_BOOL enableIsnsDiscovery, + IMA_ISNS_DISCOVERY_METHOD discoveryMethod, + const IMA_HOST_ID *iSnsHost) { + IMA_SetIsnsDiscoveryFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (enableIsnsDiscovery != IMA_TRUE && + enableIsnsDiscovery != IMA_FALSE) + return (IMA_ERROR_INVALID_PARAMETER); + + if (enableIsnsDiscovery == IMA_TRUE && iSnsHost == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (discoveryMethod != IMA_ISNS_DISCOVERY_METHOD_STATIC && + discoveryMethod != IMA_ISNS_DISCOVERY_METHOD_DHCP && + discoveryMethod != IMA_ISNS_DISCOVERY_METHOD_SLP) + return (IMA_ERROR_INVALID_PARAMETER); + + if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA && + phbaId.objectType != IMA_OBJECT_TYPE_LHBA) { + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + } + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == phbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetIsnsDiscoveryFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetIsnsDiscovery"); +#else + PassFunc = + (IMA_SetIsnsDiscoveryFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetIsnsDiscovery"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(phbaId, + enableIsnsDiscovery, + discoveryMethod, iSnsHost); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetSlpDiscovery( + IMA_OID phbaId, + IMA_BOOL enableSlpDiscovery) { + IMA_SetSlpDiscoveryFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (enableSlpDiscovery != IMA_TRUE && + enableSlpDiscovery != IMA_FALSE) + return (IMA_ERROR_INVALID_PARAMETER); + + if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA && + phbaId.objectType != IMA_OBJECT_TYPE_LHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == phbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetSlpDiscoveryFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetSlpDiscovery"); +#else + PassFunc = (IMA_SetSlpDiscoveryFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetSlpDiscovery"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + phbaId, + enableSlpDiscovery); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetStaticDiscovery( + IMA_OID phbaId, + IMA_BOOL enableStaticDiscovery) { + IMA_SetStaticDiscoveryFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (enableStaticDiscovery != IMA_TRUE && + enableStaticDiscovery != IMA_FALSE) + return (IMA_ERROR_INVALID_PARAMETER); + + if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA && + phbaId.objectType != IMA_OBJECT_TYPE_LHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == phbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetStaticDiscoveryFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetStaticDiscovery"); +#else + PassFunc = (IMA_SetStaticDiscoveryFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetStaticDiscovery"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + phbaId, + enableStaticDiscovery); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetSendTargetsDiscovery( + IMA_OID phbaId, + IMA_BOOL enableSendTargetsDiscovery) { + IMA_SetSendTargetsDiscoveryFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (enableSendTargetsDiscovery != IMA_TRUE && + enableSendTargetsDiscovery != IMA_FALSE) + return (IMA_ERROR_INVALID_PARAMETER); + + if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA && + phbaId.objectType != IMA_OBJECT_TYPE_LHBA) { + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + } + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == phbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetSendTargetsDiscoveryFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetSendTargetsDiscovery"); +#else + PassFunc = (IMA_SetSendTargetsDiscoveryFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetSendTargetsDiscovery"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + phbaId, + enableSendTargetsDiscovery); + } + os_releasemutex( + plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +/* + * this forces plugins to rescan all iscsi targets on this + * ipaddress/port and return a + * list of discovered targets. + * ERROR/todo: + * according to IMA spec., pTargetOidList is allocated by + * the caller for library to return data, + * how does a caller know how much space it will be? + * pTargetOidList should be allocated by the library/plugin + * like IMA_GetLnpOidList + */ +IMA_API IMA_STATUS IMA_AddPhbaStaticDiscoveryTarget( + IMA_OID phbaOid, + const IMA_TARGET_ADDRESS targetAddress, + IMA_OID_LIST **pTargetOidList) { + IMA_AddPhbaStaticDiscoveryTargetFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + + if (plugintable[i].ownerId == phbaOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_AddPhbaStaticDiscoveryTargetFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_AddPhbaStaticDiscoveryTarget"); +#else + PassFunc = + (IMA_AddPhbaStaticDiscoveryTargetFn) + dlsym(plugintable[i].hPlugin, + "IMA_AddPhbaStaticDiscoveryTarget"); +#endif + + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + IMA_UINT listSize; + listSize = + sizeof (IMA_OID_LIST); + status = PassFunc(phbaOid, + targetAddress, &ppOidList); + if (IMA_SUCCESS(status)) { + + (*pTargetOidList) = + (IMA_OID_LIST*) + calloc(1, listSize + + (ppOidList->oidCount-1)* + sizeof (IMA_OID)); + + if ((*pTargetOidList) == NULL) { + status = + EUOS_ERROR; + } + memcpy((*pTargetOidList), + ppOidList, + listSize + + (ppOidList->oidCount-1)* + sizeof (IMA_OID)); +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_RemovePhbaStaticDiscoveryTarget( + IMA_OID phbaOid, + IMA_OID targetOid) { + IMA_RemovePhbaStaticDiscoveryTargetFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == targetOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_RemovePhbaStaticDiscoveryTargetFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_RemovePhbaStaticDiscoveryTarget"); +#else + PassFunc = + (IMA_RemovePhbaStaticDiscoveryTargetFn) + dlsym(plugintable[i].hPlugin, + "IMA_RemovePhbaStaticDiscoveryTarget"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(phbaOid, targetOid); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetPnpOidList( + IMA_OID Oid, + IMA_OID_LIST **ppList) { + IMA_GetPnpOidListFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_PHBA && + Oid.objectType != IMA_OBJECT_TYPE_LNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetPnpOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetPnpOidList"); +#else + PassFunc = (IMA_GetPnpOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetPnpOidList"); +#endif + + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + + status = PassFunc(Oid, &ppOidList); + if (IMA_SUCCESS(status)) { + IMA_UINT listSize; + listSize = + sizeof (IMA_OID_LIST); + *ppList = (IMA_OID_LIST*) + calloc(1, listSize + + (ppOidList->oidCount-1)* + sizeof (IMA_OID)); + + if ((*ppList) == NULL) { + status = + EUOS_ERROR; + } + else + memcpy((*ppList), + ppOidList, + listSize + + (ppOidList-> + oidCount - 1)* + sizeof (IMA_OID)); +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetPhbaDownloadProperties( + IMA_OID phbaId, + IMA_PHBA_DOWNLOAD_PROPERTIES *pProps) { + IMA_GetPhbaDownloadPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == phbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetPhbaDownloadPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetPhbaDownloadProperties"); +#else + PassFunc = (IMA_GetPhbaDownloadPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetPhbaDownloadProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(phbaId, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_IsPhbaDownloadFile( + IMA_OID phbaId, + const IMA_WCHAR *pFileName, + IMA_PHBA_DOWNLOAD_IMAGE_PROPERTIES *pProps) { + IMA_IsPhbaDownloadFileFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pFileName == NULL || pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == phbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_IsPhbaDownloadFileFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_IsPhbaDownloadFile"); +#else + PassFunc = (IMA_IsPhbaDownloadFileFn) + dlsym(plugintable[i].hPlugin, + "IMA_IsPhbaDownloadFile"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + phbaId, pFileName, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_PhbaDownload( + IMA_OID phbaId, + IMA_PHBA_DOWNLOAD_IMAGE_TYPE imageType, + const IMA_WCHAR *pFileName) { + IMA_PhbaDownloadFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + if (imageType != IMA_DOWNLOAD_IMAGE_TYPE_FIRMWARE && + imageType != IMA_DOWNLOAD_IMAGE_TYPE_OPTION_ROM && + imageType != IMA_DOWNLOAD_IMAGE_TYPE_ALL && + imageType != IMA_DOWNLOAD_IMAGE_TYPE_BOOTCODE) + return (IMA_ERROR_INVALID_PARAMETER); + + if (pFileName == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == phbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_PhbaDownloadFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_PhbaDownload"); +#else + PassFunc = (IMA_PhbaDownloadFn) + dlsym(plugintable[i].hPlugin, + "IMA_PhbaDownload"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + phbaId, imageType, pFileName); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetNetworkPortalProperties( + IMA_OID networkPortalId, + IMA_NETWORK_PORTAL_PROPERTIES *pProps) { + IMA_GetNetworkPortalPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (networkPortalId.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == networkPortalId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetNetworkPortalPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetNetworkPortalProperties"); +#else + PassFunc = + (IMA_GetNetworkPortalPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetNetworkPortalProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + networkPortalId, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetNetworkPortalIpAddress( + IMA_OID networkPortalId, + const IMA_IP_ADDRESS NewIpAddress) { + IMA_SetNetworkPortalIpAddressFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (networkPortalId.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == networkPortalId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_SetNetworkPortalIpAddressFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetNetworkPortalIpAddress"); +#else + PassFunc = (IMA_SetNetworkPortalIpAddressFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetNetworkPortalIpAddress"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + networkPortalId, NewIpAddress); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetLnpOidList( + IMA_OID_LIST **ppList) { + IMA_GetLnpOidListFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + + IMA_UINT i; + IMA_UINT j; + IMA_UINT totalIdCount; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + // Get total id count first + totalIdCount = 0; + + for (i = 0; i < number_of_plugins; i++) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetLnpOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetLnpOidList"); +#else + PassFunc = (IMA_GetLnpOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetLnpOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(&ppOidList); + if (status == IMA_STATUS_SUCCESS) { + totalIdCount += ppOidList->oidCount; +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym(plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + break; + } + + } + + + *ppList = (IMA_OID_LIST*)calloc(1, + sizeof (IMA_OID_LIST) + (totalIdCount - 1)* sizeof (IMA_OID)); + + if ((*ppList) == NULL) { + os_releasemutex(libMutex); + return (IMA_ERROR_UNEXPECTED_OS_ERROR); + } + + (*ppList)->oidCount = totalIdCount; + + // 2nd pass to copy the id lists + totalIdCount = 0; + status = IMA_STATUS_SUCCESS; + for (i = 0; i < number_of_plugins; i++) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetLnpOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetLnpOidList"); +#else + PassFunc = (IMA_GetLnpOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetLnpOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(&ppOidList); + if (status == IMA_STATUS_SUCCESS) { + for (j = 0; (j < ppOidList->oidCount) && + (totalIdCount < + (*ppList)->oidCount); + j++) { + (*ppList)->oids[totalIdCount]. + objectType = + ppOidList->oids[j]. + objectType; + (*ppList)->oids[totalIdCount]. + objectSequenceNumber = + ppOidList->oids[j]. + objectSequenceNumber; + + (*ppList)->oids[totalIdCount]. + ownerId = + ppOidList->oids[j].ownerId; + totalIdCount++; + } +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym(plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + free(*ppList); + break; + } + + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetLnpProperties( + IMA_OID lnpId, + IMA_LNP_PROPERTIES *pProps) { + IMA_GetLnpPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (lnpId.objectType != IMA_OBJECT_TYPE_LNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lnpId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetLnpPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetLnpProperties"); +#else + PassFunc = (IMA_GetLnpPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetLnpProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(lnpId, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetPnpProperties( + IMA_OID pnpId, + IMA_PNP_PROPERTIES *pProps) { + IMA_GetPnpPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (pnpId.objectType != IMA_OBJECT_TYPE_PNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == pnpId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetPnpPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetPnpProperties"); +#else + PassFunc = (IMA_GetPnpPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetPnpProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(pnpId, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetPnpStatistics( + IMA_OID pnpId, + IMA_PNP_STATISTICS *pStats) { + IMA_GetPnpStatisticsFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pStats == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (pnpId.objectType != IMA_OBJECT_TYPE_PNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == pnpId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetPnpStatisticsFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetPnpStatistics"); +#else + PassFunc = (IMA_GetPnpStatisticsFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetPnpStatistics"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(pnpId, pStats); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetTargetProperties( + IMA_OID targetId, + IMA_TARGET_PROPERTIES *pProps) { + IMA_GetTargetPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (targetId.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == targetId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetTargetPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetTargetProperties"); +#else + PassFunc = (IMA_GetTargetPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetTargetProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(targetId, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_GetSessionProperties( + IMA_OID sessionId, + IMA_SESSION_PROPERTIES *pProps) { + IMA_GetSessionPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (sessionId.objectType != IMA_OBJECT_TYPE_SESSION) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == sessionId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetSessionPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetSessionProperties"); +#else + PassFunc = (IMA_GetSessionPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetSessionProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(sessionId, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetConnectionProperties( + IMA_OID connectionId, + IMA_CONNECTION_PROPERTIES *pProps) { + IMA_GetConnectionPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (connectionId.objectType != IMA_OBJECT_TYPE_CONNECTION) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == connectionId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetConnectionPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetConnectionProperties"); +#else + PassFunc = (IMA_GetConnectionPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetConnectionProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(connectionId, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetTargetErrorStatistics( + IMA_OID targetId, + IMA_TARGET_ERROR_STATISTICS *pStats) { + IMA_GetTargetErrorStatisticsFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pStats == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (targetId.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == targetId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetTargetErrorStatisticsFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetTargetErrorStatistics"); +#else + PassFunc = (IMA_GetTargetErrorStatisticsFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetTargetErrorStatistics"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(targetId, pStats); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetLuOidList( + IMA_OID Oid, + IMA_OID_LIST **ppList) { + IMA_GetLuOidListFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && + Oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetLuOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetLuOidList"); +#else + PassFunc = (IMA_GetLuOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetLuOidList"); +#endif + + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + + status = PassFunc(Oid, &ppOidList); + if (IMA_SUCCESS(status)) { + IMA_UINT listSize; + listSize = + sizeof (IMA_OID_LIST); + *ppList = (IMA_OID_LIST*) + calloc(1, listSize + + (ppOidList->oidCount - 1)* + sizeof (IMA_OID)); + + if ((*ppList) == NULL) { + status = EUOS_ERROR; + } + else + memcpy((*ppList), + ppOidList, + listSize + + (ppOidList-> + oidCount - 1)* + sizeof (IMA_OID)); +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetLuOid( + IMA_OID targetId, + IMA_UINT64 lun, + IMA_OID *pluId) { + IMA_GetLuOidFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pluId == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + + if (targetId.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == targetId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex( + plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetLuOidFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_GetLuOid"); +#else + PassFunc = (IMA_GetLuOidFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetLuOid"); +#endif + + if (PassFunc != NULL) { + status = + PassFunc(targetId, lun, pluId); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetLuProperties( + IMA_OID luId, + IMA_LU_PROPERTIES *pProps) { + IMA_GetLuPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (luId.objectType != IMA_OBJECT_TYPE_LU) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == luId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetLuPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetLuProperties"); +#else + PassFunc = (IMA_GetLuPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetLuProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(luId, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetStatisticsProperties( + IMA_OID oid, + IMA_STATISTICS_PROPERTIES *pProps) { + IMA_GetStatisticsPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (oid.objectType != IMA_OBJECT_TYPE_TARGET && + oid.objectType != IMA_OBJECT_TYPE_LU && + oid.objectType != IMA_OBJECT_TYPE_PNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetStatisticsPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetStatisticsProperties"); +#else + PassFunc = + (IMA_GetStatisticsPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetStatisticsProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetDeviceStatistics( + IMA_OID oid, + IMA_DEVICE_STATISTICS *pStats) { + IMA_GetDeviceStatisticsFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pStats == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (oid.objectType != IMA_OBJECT_TYPE_LU && + oid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetDeviceStatisticsFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetDeviceStatistics"); +#else + PassFunc = + (IMA_GetDeviceStatisticsFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetDeviceStatistics"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid, pStats); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_LuInquiry( + IMA_OID deviceId, + IMA_BOOL evpd, + IMA_BOOL cmddt, + IMA_BYTE pageCode, + + IMA_BYTE *pOutputBuffer, + IMA_UINT *pOutputBufferLength, + + IMA_BYTE *pSenseBuffer, + IMA_UINT *pSenseBufferLength) { + IMA_LuInquiryFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pOutputBuffer == NULL || pOutputBufferLength == NULL || + *pOutputBufferLength == 0 || + pSenseBuffer == NULL || pSenseBufferLength == NULL || + *pSenseBufferLength == 0) + return (IMA_ERROR_INVALID_PARAMETER); + + if ((evpd != IMA_TRUE && evpd != IMA_FALSE) || + (cmddt != IMA_TRUE && cmddt != IMA_FALSE)) + return (IMA_ERROR_INVALID_PARAMETER); + + if (deviceId.objectType != IMA_OBJECT_TYPE_TARGET && + deviceId.objectType != IMA_OBJECT_TYPE_LU) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == deviceId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_LuInquiryFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_LuInquiry"); +#else + PassFunc = (IMA_LuInquiryFn) + dlsym(plugintable[i].hPlugin, + "IMA_LuInquiry"); +#endif + + if (PassFunc != NULL) { + status = + PassFunc(deviceId, evpd, + cmddt, pageCode, + pOutputBuffer, pOutputBufferLength, + pSenseBuffer, pSenseBufferLength); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_LuReadCapacity( + IMA_OID deviceId, + IMA_UINT cdbLength, + IMA_BYTE *pOutputBuffer, + IMA_UINT *pOutputBufferLength, + + IMA_BYTE *pSenseBuffer, + IMA_UINT *pSenseBufferLength) { + IMA_LuReadCapacityFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (cdbLength != 10 && cdbLength != 16) + return (IMA_ERROR_INVALID_PARAMETER); + + if ((pOutputBuffer == NULL || pOutputBufferLength == NULL || + *pOutputBufferLength == 0) || + (pSenseBuffer == NULL && pSenseBufferLength != NULL && + *pSenseBufferLength != 0)) + return (IMA_ERROR_INVALID_PARAMETER); + + if (deviceId.objectType != IMA_OBJECT_TYPE_TARGET && + deviceId.objectType != IMA_OBJECT_TYPE_LU) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == deviceId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_LuReadCapacityFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_LuReadCapacity"); +#else + PassFunc = (IMA_LuReadCapacityFn) + dlsym(plugintable[i].hPlugin, + "IMA_LuReadCapacity"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(deviceId, cdbLength, + pOutputBuffer, pOutputBufferLength, + pSenseBuffer, pSenseBufferLength); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_LuReportLuns( + IMA_OID deviceId, + IMA_BOOL sendToWellKnownLun, + IMA_BYTE selectReport, + + IMA_BYTE *pOutputBuffer, + IMA_UINT *pOutputBufferLength, + + IMA_BYTE *pSenseBuffer, + IMA_UINT *pSenseBufferLength) { + IMA_LuReportLunsFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if ((pOutputBuffer == NULL || pOutputBufferLength == NULL || + *pOutputBufferLength == 0) || + (pSenseBuffer == NULL && pSenseBufferLength != NULL && + *pSenseBufferLength != 0)) + return (IMA_ERROR_INVALID_PARAMETER); + + if (sendToWellKnownLun != IMA_TRUE && sendToWellKnownLun != IMA_FALSE) + return (IMA_ERROR_INVALID_PARAMETER); + + if (deviceId.objectType != IMA_OBJECT_TYPE_TARGET && + deviceId.objectType != IMA_OBJECT_TYPE_LU) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == deviceId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_LuReportLunsFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_LuReportLuns"); +#else + PassFunc = (IMA_LuReportLunsFn) + dlsym(plugintable[i].hPlugin, + "IMA_LuReportLuns"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(deviceId, + sendToWellKnownLun, selectReport, + pOutputBuffer, pOutputBufferLength, + pSenseBuffer, pSenseBufferLength); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_ExposeLu( + IMA_OID luId) { + IMA_ExposeLuFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (luId.objectType != IMA_OBJECT_TYPE_LU) + return (IMA_ERROR_INVALID_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == luId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_ExposeLuFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_ExposeLu"); + +#else + PassFunc = (IMA_ExposeLuFn) + dlsym(plugintable[i].hPlugin, + "IMA_ExposeLu"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(luId); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_UnexposeLu( + IMA_OID luId) { + IMA_UnexposeLuFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (luId.objectType != IMA_OBJECT_TYPE_LU) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == luId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_UnexposeLuFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_UnexposeLu"); +#else + PassFunc = (IMA_UnexposeLuFn) + dlsym(plugintable[i].hPlugin, + "IMA_UnexposeLu"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(luId); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetPhbaStatus( + IMA_OID hbaId, + IMA_PHBA_STATUS *pStatus) { + IMA_GetPhbaStatusFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pStatus == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (hbaId.objectType != IMA_OBJECT_TYPE_PHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == hbaId.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetPhbaStatusFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetPhbaStatus"); +#else + PassFunc = (IMA_GetPhbaStatusFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetPhbaStatus"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(hbaId, pStatus); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_RegisterForObjectVisibilityChanges( + IMA_OBJECT_VISIBILITY_FN pClientFn) { + IMA_RegisterForObjectVisibilityChangesFn PassFunc; + IMA_UINT i; + IMA_UINT j; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pClientFn == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + + status = IMA_STATUS_SUCCESS; + for (i = 0; i < number_of_plugins; i++) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); + if (plugintable[i].number_of_vbcallbacks >= + IMA_MAX_CALLBACK_PER_PLUGIN) { + os_releasemutex(plugintable[i].pluginMutex); + continue; + } + + /* check if registered already */ + for (j = 0; + j < plugintable[i].number_of_vbcallbacks; j++) { + if (plugintable[i].vbcallback[j] == pClientFn) { + status = IMA_STATUS_SUCCESS; + break; + } + } + if (status != IMA_STATUS_SUCCESS) { + +#ifdef WIN32 + PassFunc = + (IMA_RegisterForObjectVisibilityChangesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_RegisterForObjectVisibilityChanges"); +#else + PassFunc = + (IMA_RegisterForObjectVisibilityChangesFn) + dlsym(plugintable[i].hPlugin, + "IMA_RegisterForObjectVisibilityChanges"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(VisibilityCallback); + if (status == IMA_STATUS_SUCCESS) { + j = plugintable[i]. + number_of_vbcallbacks; + plugintable[i].vbcallback[j] = + pClientFn; + plugintable[i]. + number_of_vbcallbacks++; + } + + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) + break; + + } + os_releasemutex(libMutex); + return (status); + +} + + +IMA_API IMA_STATUS IMA_DeregisterForObjectVisibilityChanges( + IMA_OBJECT_VISIBILITY_FN pClientFn) { + IMA_DeregisterForObjectVisibilityChangesFn PassFunc; + IMA_UINT i; + IMA_UINT j; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pClientFn == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + + status = IMA_STATUS_SUCCESS; + for (i = 0; i < number_of_plugins; i++) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); + /* check if deregistered already */ + status = IMA_STATUS_SUCCESS; + for (j = 0; + j < plugintable[i].number_of_vbcallbacks; j++) { + if (plugintable[i].vbcallback[j] == pClientFn) { + /* + * use IMA_ERROR_UNKNOWN_ERROR + * as a flag + */ + status = IMA_ERROR_UNKNOWN_ERROR; + break; + } + } + + if (status != IMA_STATUS_SUCCESS) { + +#ifdef WIN32 + PassFunc = + (IMA_DeregisterForObjectVisibilityChangesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_DeregisterForObjectVisibilityChanges"); +#else + PassFunc = + (IMA_DeregisterForObjectVisibilityChangesFn) + dlsym(plugintable[i].hPlugin, + "IMA_DeregisterForObjectVisibilityChanges"); +#endif + if (PassFunc != NULL) { + status = PassFunc(VisibilityCallback); + if (status == IMA_STATUS_SUCCESS) { + /* + * where plugintable[i]. + * vbcallback[j] == pClientFn + */ + for (; j < + plugintable[i]. + number_of_vbcallbacks; + j++) { + plugintable[i]. + vbcallback[j] = + plugintable[i]. + vbcallback[j+1]; + + } + plugintable[i]. + number_of_vbcallbacks--; + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) + break; + } + os_releasemutex(libMutex); + return (status); + +} + + +IMA_API IMA_STATUS IMA_RegisterForObjectPropertyChanges( + IMA_OBJECT_PROPERTY_FN pClientFn) { + IMA_RegisterForObjectPropertyChangesFn PassFunc; + IMA_UINT i; + IMA_UINT j; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pClientFn == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + + status = IMA_STATUS_SUCCESS; + for (i = 0; i < number_of_plugins; i++) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); + if (plugintable[i].number_of_pccallbacks >= + IMA_MAX_CALLBACK_PER_PLUGIN) { + os_releasemutex(plugintable[i].pluginMutex); + continue; + } + + /* check if registered already */ + for (j = 0; + j < plugintable[i].number_of_pccallbacks; + j++) { + if (plugintable[i].pccallback[j] == + pClientFn) { + status = IMA_STATUS_SUCCESS; + break; + } + } + if (status != IMA_STATUS_SUCCESS) { + +#ifdef WIN32 + PassFunc = + (IMA_RegisterForObjectPropertyChangesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_RegisterForObjectPropertyChanges"); +#else + PassFunc = + (IMA_RegisterForObjectPropertyChangesFn) + dlsym(plugintable[i].hPlugin, + "IMA_RegisterForObjectPropertyChanges"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(PropertyCallback); + if (status == IMA_STATUS_SUCCESS) { + j = plugintable[i]. + number_of_pccallbacks; + plugintable[i].pccallback[j] = + pClientFn; + plugintable[i]. + number_of_pccallbacks++; + } + + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) + break; + + } + os_releasemutex(libMutex); + return (status); + +} + + +IMA_API IMA_STATUS IMA_DeregisterForObjectPropertyChanges( + IMA_OBJECT_PROPERTY_FN pClientFn) { + IMA_DeregisterForObjectPropertyChangesFn PassFunc; + IMA_UINT i; + IMA_UINT j; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pClientFn == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + status = IMA_STATUS_SUCCESS; + for (i = 0; i < number_of_plugins; i++) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); + /* check if deregistered already */ + status = IMA_STATUS_SUCCESS; + for (j = 0; + j < plugintable[i].number_of_pccallbacks; + j++) { + if (plugintable[i].pccallback[j] == + pClientFn) { + /* + * use IMA_ERROR_UNKNOWN_ERROR + * as a flag + */ + status = IMA_ERROR_UNKNOWN_ERROR; + break; + } + } + + if (status != IMA_STATUS_SUCCESS) { + +#ifdef WIN32 + PassFunc = + (IMA_DeregisterForObjectPropertyChangesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_DeregisterForObjectPropertyChanges"); + +#else + PassFunc = + (IMA_DeregisterForObjectPropertyChangesFn) + dlsym(plugintable[i].hPlugin, + "IMA_DeregisterForObjectPropertyChanges"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(PropertyCallback); + if (status == IMA_STATUS_SUCCESS) { + /* + * where plugintable[i].vbcallback[ + * j] == pClientFn + */ + for (; j < plugintable[i]. + number_of_pccallbacks; + j++) { + plugintable[i]. + pccallback[j] + = plugintable[i]. + pccallback[j+1]; + + } + plugintable[i]. + number_of_pccallbacks--; + } + + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) + break; + + } + os_releasemutex(libMutex); + return (status); + +} + + +IMA_API IMA_STATUS IMA_GetIpProperties( + IMA_OID oid, + IMA_IP_PROPERTIES *pProps) { + IMA_GetIpPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (oid.objectType != IMA_OBJECT_TYPE_PNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetIpPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetIpProperties"); +#else + PassFunc = (IMA_GetIpPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetIpProperties"); +#endif + if (PassFunc != NULL) { + status = PassFunc(oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetIpConfigMethod( + IMA_OID oid, + IMA_BOOL enableDhcpIpConfiguration) { + IMA_SetIpConfigMethodFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (enableDhcpIpConfiguration != IMA_TRUE && + enableDhcpIpConfiguration != IMA_FALSE) + return (IMA_ERROR_INVALID_PARAMETER); + + if (oid.objectType != IMA_OBJECT_TYPE_PNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetIpConfigMethodFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetIpConfigMethod"); +#else + PassFunc = (IMA_SetIpConfigMethodFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetIpConfigMethod"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid, + enableDhcpIpConfiguration); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_SetSubnetMask( + IMA_OID oid, + IMA_IP_ADDRESS subnetMask) { + IMA_SetSubnetMaskFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (oid.objectType != IMA_OBJECT_TYPE_PNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetSubnetMaskFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetSubnetMask"); +#else + PassFunc = (IMA_SetSubnetMaskFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetSubnetMask"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid, subnetMask); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetDnsServerAddress( + IMA_OID oid, + const IMA_IP_ADDRESS *primaryDnsServerAddress, + const IMA_IP_ADDRESS *alternateDnsServerAddress) { + IMA_SetDnsServerAddressFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (primaryDnsServerAddress == NULL && + alternateDnsServerAddress != NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (primaryDnsServerAddress != NULL && + alternateDnsServerAddress != NULL && + memcmp(primaryDnsServerAddress->ipAddress, + alternateDnsServerAddress->ipAddress, + sizeof (primaryDnsServerAddress->ipAddress)) == 0) + return (IMA_ERROR_INVALID_PARAMETER); + + if (oid.objectType != IMA_OBJECT_TYPE_PNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetDnsServerAddressFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetDnsServerAddress"); +#else + PassFunc = (IMA_SetDnsServerAddressFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetDnsServerAddress"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid, + primaryDnsServerAddress, + alternateDnsServerAddress); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_SetDefaultGateway( + IMA_OID oid, + IMA_IP_ADDRESS defaultGateway) { + IMA_SetDefaultGatewayFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (oid.objectType != IMA_OBJECT_TYPE_PNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetDefaultGatewayFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetDefaultGateway"); +#else + PassFunc = (IMA_SetDefaultGatewayFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetDefaultGateway"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid, defaultGateway); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetSupportedAuthMethods( + IMA_OID lhbaOid, + IMA_BOOL getSettableMethods, + IMA_UINT *pMethodCount, + IMA_AUTHMETHOD *pMethodList) { + IMA_GetSupportedAuthMethodsFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pMethodCount == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetSupportedAuthMethodsFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetSupportedAuthMethods"); +#else + PassFunc = (IMA_GetSupportedAuthMethodsFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetSupportedAuthMethods"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(lhbaOid, + getSettableMethods, + pMethodCount, pMethodList); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetInUseInitiatorAuthMethods( + IMA_OID lhbaOid, + IMA_UINT *pMethodCount, + IMA_AUTHMETHOD *pMethodList) { + IMA_GetInUseInitiatorAuthMethodsFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pMethodCount == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetInUseInitiatorAuthMethodsFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetInUseInitiatorAuthMethods"); +#else + PassFunc = (IMA_GetInUseInitiatorAuthMethodsFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetInUseInitiatorAuthMethods"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(lhbaOid, + pMethodCount, pMethodList); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + + +IMA_API IMA_STATUS IMA_GetInitiatorAuthParms( + IMA_OID lhbaOid, + IMA_AUTHMETHOD method, + IMA_INITIATOR_AUTHPARMS *pParms) { + IMA_GetInitiatorAuthParmsFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pParms == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + if (method != IMA_AUTHMETHOD_NONE && + method != IMA_AUTHMETHOD_CHAP && + method != IMA_AUTHMETHOD_SRP && + method != IMA_AUTHMETHOD_KRB5 && + method != IMA_AUTHMETHOD_SPKM1 && + method != IMA_AUTHMETHOD_SPKM2) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetInitiatorAuthParmsFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetInitiatorAuthParms"); +#else + PassFunc = (IMA_GetInitiatorAuthParmsFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetInitiatorAuthParms"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(lhbaOid, + method, pParms); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_SetInitiatorAuthMethods( + IMA_OID lhbaOid, + IMA_UINT methodCount, + const IMA_AUTHMETHOD *pMethodList) { + IMA_SetInitiatorAuthMethodsFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (methodCount == 0 || pMethodList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetInitiatorAuthMethodsFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetInitiatorAuthMethods"); +#else + PassFunc = (IMA_SetInitiatorAuthMethodsFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetInitiatorAuthMethods"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(lhbaOid, + methodCount, pMethodList); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_SetInitiatorAuthParms( + IMA_OID lhbaOid, + IMA_AUTHMETHOD method, + const IMA_INITIATOR_AUTHPARMS *pParms) { + + IMA_SetInitiatorAuthParmsFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pParms == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (method != IMA_AUTHMETHOD_NONE && + method != IMA_AUTHMETHOD_CHAP && + method != IMA_AUTHMETHOD_SRP && + method != IMA_AUTHMETHOD_KRB5 && + method != IMA_AUTHMETHOD_SPKM1 && + method != IMA_AUTHMETHOD_SPKM2) + return (IMA_ERROR_INVALID_PARAMETER); + + if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == lhbaOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_SetInitiatorAuthParmsFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_SetInitiatorAuthParms"); +#else + PassFunc = (IMA_SetInitiatorAuthParmsFn) + dlsym(plugintable[i].hPlugin, + "IMA_SetInitiatorAuthParms"); +#endif + + if (PassFunc != NULL) { + status = + PassFunc( + lhbaOid, method, pParms); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_GetStaticDiscoveryTargetOidList( + IMA_OID oid, + IMA_OID_LIST **ppList) { + IMA_GetStaticDiscoveryTargetOidListFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (oid.objectType != IMA_OBJECT_TYPE_LHBA && + oid.objectType != IMA_OBJECT_TYPE_PNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetStaticDiscoveryTargetOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetStaticDiscoveryTargetOidList"); +#else + PassFunc = + (IMA_GetStaticDiscoveryTargetOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetStaticDiscoveryTargetOidList"); +#endif + if (PassFunc != NULL) { + status = PassFunc(oid, ppList); + } + + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_GetDiscoveryProperties( + IMA_OID oid, + IMA_DISCOVERY_PROPERTIES *pProps) { + IMA_GetDiscoveryPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (oid.objectType != IMA_OBJECT_TYPE_PHBA && + oid.objectType != IMA_OBJECT_TYPE_LHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetDiscoveryPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetDiscoveryProperties"); +#else + PassFunc = (IMA_GetDiscoveryPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetDiscoveryProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_AddDiscoveryAddress( + IMA_OID oid, + const IMA_TARGET_ADDRESS discoveryAddress, + IMA_OID *pDiscoveryAddressOid) { + IMA_AddDiscoveryAddressFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (oid.objectType != IMA_OBJECT_TYPE_LHBA && + oid.objectType != IMA_OBJECT_TYPE_PNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_AddDiscoveryAddressFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_AddDiscoveryAddress"); +#else + PassFunc = (IMA_AddDiscoveryAddressFn) + dlsym(plugintable[i].hPlugin, + "IMA_AddDiscoveryAddress"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid, + discoveryAddress, + pDiscoveryAddressOid); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_AddStaticDiscoveryTarget( + IMA_OID oid, + const IMA_STATIC_DISCOVERY_TARGET staticDiscoveryTarget, + IMA_OID *pStaticDiscoveryTargetOid) { + IMA_AddStaticDiscoveryTargetFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (oid.objectType != IMA_OBJECT_TYPE_LHBA && + oid.objectType != IMA_OBJECT_TYPE_PNP) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_AddStaticDiscoveryTargetFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_AddStaticDiscoveryTarget"); + +#else + PassFunc = (IMA_AddStaticDiscoveryTargetFn) + dlsym(plugintable[i].hPlugin, + "IMA_AddStaticDiscoveryTarget"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid, + staticDiscoveryTarget, + pStaticDiscoveryTargetOid); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_CommitHbaParameters(IMA_OID oid, + IMA_COMMIT_LEVEL commitLevel) +{ + IMA_CommitHbaParametersFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (oid.objectType != IMA_OBJECT_TYPE_LHBA && + oid.objectType != IMA_OBJECT_TYPE_PHBA) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_CommitHbaParametersFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_CommitHbaParameters"); +#else + PassFunc = (IMA_CommitHbaParametersFn) + dlsym(plugintable[i].hPlugin, + "IMA_CommitHbaParameters"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid, commitLevel); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_RemoveStaticDiscoveryTarget( + IMA_OID oid) { + IMA_RemoveStaticDiscoveryTargetFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (oid.objectType != IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_RemoveStaticDiscoveryTargetFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_RemoveStaticDiscoveryTarget"); +#else + PassFunc = (IMA_RemoveStaticDiscoveryTargetFn) + dlsym(plugintable[i].hPlugin, + "IMA_RemoveStaticDiscoveryTarget"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_GetStaticDiscoveryTargetProperties( + IMA_OID staticDiscoveryTargetOid, + IMA_STATIC_DISCOVERY_TARGET_PROPERTIES *pProps) { + IMA_GetStaticDiscoveryTargetPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (staticDiscoveryTargetOid.objectType != + IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == + staticDiscoveryTargetOid.ownerId) { + + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetStaticDiscoveryTargetPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetStaticDiscoveryTargetProperties"); +#else + PassFunc = + (IMA_GetStaticDiscoveryTargetPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetStaticDiscoveryTargetProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc( + staticDiscoveryTargetOid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_GetDiscoveryAddressOidList( + IMA_OID Oid, + IMA_OID_LIST **ppList) { + + IMA_GetDiscoveryAddressOidListFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + + IMA_UINT i; + IMA_UINT j; + IMA_UINT totalIdCount; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if ((Oid.objectType != IMA_OBJECT_TYPE_LHBA) && + (Oid.objectType != IMA_OBJECT_TYPE_PNP)) { + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + } + + os_obtainmutex(libMutex); + // Get total id count first + totalIdCount = 0; + + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetDiscoveryAddressOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetDiscoveryAddressOidList"); +#else + PassFunc = (IMA_GetDiscoveryAddressOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetDiscoveryAddressOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(Oid, &ppOidList); + if (status == IMA_STATUS_SUCCESS) { + totalIdCount += + ppOidList->oidCount; +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + break; + } + } + } + + *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + + (totalIdCount - 1)* sizeof (IMA_OID)); + + if ((*ppList) == NULL) { + os_releasemutex(libMutex); + return (IMA_ERROR_UNEXPECTED_OS_ERROR); + } + (*ppList)->oidCount = totalIdCount; + + // 2nd pass to copy the id lists + totalIdCount = 0; + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetDiscoveryAddressOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetDiscoveryAddressOidList"); +#else + PassFunc = (IMA_GetDiscoveryAddressOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetDiscoveryAddressOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(Oid, &ppOidList); + if (status == IMA_STATUS_SUCCESS) { + for (j = 0; + (j < ppOidList->oidCount) && + (totalIdCount < + (*ppList)->oidCount); + j++) { +#define OBJ_SEQ_NUM ppOidList->oids[j].objectSequenceNumber + (*ppList)->oids + [totalIdCount]. + objectType = + ppOidList->oids[j]. + objectType; + (*ppList)->oids[ + totalIdCount]. + objectSequenceNumber + = OBJ_SEQ_NUM; + (*ppList)->oids[ + totalIdCount]. + ownerId = + ppOidList-> + oids[j].ownerId; + totalIdCount++; +#undef OBJ_SEQ_NUM + } +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + free(*ppList); + break; + } + } + } + + os_releasemutex(libMutex); + return (status); + +} + +IMA_API IMA_STATUS IMA_GetSessionOidList( + IMA_OID Oid, + IMA_OID_LIST **ppList) { + + IMA_GetSessionOidListFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + + IMA_UINT i; + IMA_UINT j; + IMA_UINT totalIdCount; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if ((Oid.objectType != IMA_OBJECT_TYPE_LHBA) && + (Oid.objectType != IMA_OBJECT_TYPE_TARGET)) { + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + } + + os_obtainmutex(libMutex); + // Get total id count first + totalIdCount = 0; + + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetSessionOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetSessionOidList"); +#else + PassFunc = (IMA_GetSessionOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetSessionOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(Oid, &ppOidList); + if (status == IMA_STATUS_SUCCESS) { + totalIdCount += + ppOidList->oidCount; +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + break; + } + } + } + + *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + + (totalIdCount - 1)* sizeof (IMA_OID)); + + if ((*ppList) == NULL) { + os_releasemutex(libMutex); + return (IMA_ERROR_UNEXPECTED_OS_ERROR); + } + (*ppList)->oidCount = totalIdCount; + + // 2nd pass to copy the id lists + totalIdCount = 0; + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetSessionOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetSessionOidList"); +#else + PassFunc = (IMA_GetSessionOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetSessionOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(Oid, &ppOidList); + if (status == IMA_STATUS_SUCCESS) { + for (j = 0; + (j < ppOidList->oidCount) && + (totalIdCount < + (*ppList)->oidCount); + j++) { + +#define OBJ_SEQ_NUM ppOidList->oids[j].objectSequenceNumber + (*ppList)->oids[ + totalIdCount]. + objectType = + ppOidList->oids[j]. + objectType; + (*ppList)->oids[ + totalIdCount]. + objectSequenceNumber + = OBJ_SEQ_NUM; + (*ppList)->oids[ + totalIdCount]. + ownerId = + ppOidList->oids[j]. + ownerId; + totalIdCount++; +#undef OBJ_SEQ_NUM + } +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + free(*ppList); + break; + } + } + } + + os_releasemutex(libMutex); + return (status); + +} + +IMA_API IMA_STATUS IMA_GetConnectionOidList( + IMA_OID Oid, + IMA_OID_LIST **ppList) { + + IMA_GetSessionOidListFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + + IMA_UINT i; + IMA_UINT j; + IMA_UINT totalIdCount; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppList == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (Oid.objectType != IMA_OBJECT_TYPE_SESSION) { + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + } + + os_obtainmutex(libMutex); + // Get total id count first + totalIdCount = 0; + + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetConnectionOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetConnectionOidList"); +#else + PassFunc = (IMA_GetConnectionOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetConnectionOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(Oid, &ppOidList); + if (status == IMA_STATUS_SUCCESS) { + totalIdCount += + ppOidList->oidCount; +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + break; + } + } + } + + + *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + + (totalIdCount - 1)* sizeof (IMA_OID)); + + if ((*ppList) == NULL) { + os_releasemutex(libMutex); + return (IMA_ERROR_UNEXPECTED_OS_ERROR); + } + (*ppList)->oidCount = totalIdCount; + + // 2nd pass to copy the id lists + totalIdCount = 0; + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == Oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetConnectionOidListFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetConnectionOidList"); +#else + PassFunc = (IMA_GetConnectionOidListFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetConnectionOidList"); +#endif + if (PassFunc != NULL) { + IMA_OID_LIST *ppOidList; + status = PassFunc(Oid, &ppOidList); + if (status == IMA_STATUS_SUCCESS) { + for (j = 0; ( + j < ppOidList->oidCount) && + (totalIdCount < + (*ppList)->oidCount); + j++) { +#define OBJ_SEQ_NUM ppOidList->oids[j].objectSequenceNumber + (*ppList)-> + oids[totalIdCount]. + objectType = + ppOidList-> + oids[j].objectType; + (*ppList)-> + oids[totalIdCount]. + objectSequenceNumber + = OBJ_SEQ_NUM; + (*ppList)-> + oids[totalIdCount]. + ownerId = + ppOidList->oids[j]. + ownerId; + totalIdCount++; +#undef OBJ_SEQ_NUM + } +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppOidList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + if (status != IMA_STATUS_SUCCESS) { + free(*ppList); + break; + } + } + } + os_releasemutex(libMutex); + return (status); + +} + +IMA_API IMA_STATUS IMA_RemoveDiscoveryAddress( + IMA_OID discoveryAddressOid) { + + IMA_RemoveDiscoveryAddressFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (discoveryAddressOid.objectType != + IMA_OBJECT_TYPE_DISCOVERY_ADDRESS) { + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + } + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == discoveryAddressOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_RemoveDiscoveryAddressFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_RemoveDiscoveryAddress"); +#else + PassFunc = (IMA_RemoveDiscoveryAddressFn) + dlsym(plugintable[i].hPlugin, + "IMA_RemoveDiscoveryAddress"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(discoveryAddressOid); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_GetIpsecProperties( + IMA_OID oid, + IMA_IPSEC_PROPERTIES *pProps) { + IMA_GetIpsecPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (oid.objectType != IMA_OBJECT_TYPE_PNP && + oid.objectType != IMA_OBJECT_TYPE_LHBA) { + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + } + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = (IMA_GetIpsecPropertiesFn) + GetProcAddress(plugintable[i].hPlugin, + "IMA_GetIpsecProperties"); +#else + PassFunc = (IMA_GetIpsecPropertiesFn) + dlsym(plugintable[i].hPlugin, + "IMA_GetIpsecProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_GetAddressKeys( + IMA_OID targetOid, + IMA_ADDRESS_KEYS **ppKeys) { + IMA_GetAddressKeysFn PassFunc; + IMA_FreeMemoryFn FreeFunc; + + IMA_STATUS status; + IMA_UINT i; + + + if (number_of_plugins == -1) + InitLibrary(); + + if (ppKeys == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (targetOid.objectType != IMA_OBJECT_TYPE_TARGET) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + + status = IMA_ERROR_OBJECT_NOT_FOUND; + for (i = 0; i < number_of_plugins; i++) { + + if (plugintable[i].ownerId == targetOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetAddressKeysFn) GetProcAddress( + plugintable[i].hPlugin, + "IMA_GetAddressKeys"); +#else + PassFunc = (IMA_GetAddressKeysFn) dlsym( + plugintable[i].hPlugin, + "IMA_GetAddressKeys"); +#endif + + if (PassFunc != NULL) { + IMA_ADDRESS_KEYS *ppKeysList; + IMA_UINT addrSize; + addrSize = sizeof (IMA_ADDRESS_KEYS); + status = + PassFunc(targetOid, &ppKeysList); + if (IMA_SUCCESS(status)) { + + *ppKeys = + (IMA_ADDRESS_KEYS*)calloc(1, + addrSize + + (ppKeysList->addressKeyCount + - 1) * addrSize); + if ((*ppKeys) == NULL) { + status = EUOS_ERROR; + } else { + memcpy((*ppKeys), + ppKeysList, + addrSize + + (ppKeysList-> + addressKeyCount-1)* + addrSize); + + } +#ifdef WIN32 + FreeFunc = (IMA_FreeMemoryFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#else + FreeFunc = (IMA_FreeMemoryFn) + dlsym( + plugintable[i].hPlugin, + "IMA_FreeMemory"); +#endif + if (FreeFunc != NULL) { + FreeFunc(ppKeysList); + } + } + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS IMA_GetDiscoveryAddressProperties( + IMA_OID oid, + IMA_DISCOVERY_ADDRESS_PROPERTIES *pProps) { + + IMA_GetDiscoveryAddressPropertiesFn PassFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (pProps == NULL) + return (IMA_ERROR_INVALID_PARAMETER); + + if (oid.objectType != IMA_OBJECT_TYPE_DISCOVERY_ADDRESS) + return (IMA_ERROR_INCORRECT_OBJECT_TYPE); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == oid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + PassFunc = + (IMA_GetDiscoveryAddressPropertiesFn) + GetProcAddress( + plugintable[i].hPlugin, + "IMA_GetDiscoveryAddressProperties"); +#else + PassFunc = + (IMA_GetDiscoveryAddressPropertiesFn) dlsym( + plugintable[i].hPlugin, + "IMA_GetDiscoveryAddressProperties"); +#endif + + if (PassFunc != NULL) { + status = PassFunc(oid, pProps); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); +} + +IMA_API IMA_STATUS QIMA_SetUpdateInterval( + IMA_OID pluginOid, time_t interval) { + QIMA_SetUpdateIntervalFn updFunc; + IMA_UINT i; + IMA_STATUS status; + + if (number_of_plugins == -1) + InitLibrary(); + + if (interval <= 1) + return (IMA_ERROR_INVALID_PARAMETER); + + if ((pluginOid.objectType != IMA_OBJECT_TYPE_PLUGIN) || + (pluginOid.objectSequenceNumber != 0)) + return (IMA_ERROR_INVALID_PARAMETER); + + os_obtainmutex(libMutex); + status = IMA_ERROR_OBJECT_NOT_FOUND; + + for (i = 0; i < number_of_plugins; i++) { + if (plugintable[i].ownerId == pluginOid.ownerId) { + status = IMA_ERROR_UNEXPECTED_OS_ERROR; + if (plugintable[i].hPlugin != NULL) { + os_obtainmutex(plugintable[i].pluginMutex); +#ifdef WIN32 + updFunc = (QIMA_SetUpdateIntervalFn) + GetProcAddress( + plugintable[i].hPlugin, + "QIMA_SetUpdateInterval"); +#else + updFunc = (QIMA_SetUpdateIntervalFn) dlsym( + plugintable[i].hPlugin, + "QIMA_SetUpdateInterval"); +#endif + + if (updFunc != NULL) { + status = updFunc(pluginOid, interval); + } + os_releasemutex(plugintable[i].pluginMutex); + } + + break; + } + } + os_releasemutex(libMutex); + return (status); + +} diff --git a/usr/src/lib/libima/common/ima-plugin.h b/usr/src/lib/libima/common/ima-plugin.h new file mode 100644 index 0000000000..c6a052dc3b --- /dev/null +++ b/usr/src/lib/libima/common/ima-plugin.h @@ -0,0 +1,634 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * + * Description + * imaPlugin.h: interface for the iScsiPlugin class. + * + * License: + * The contents of this file are subject to the SNIA Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * + * /http://www.snia.org/English/Resources/Code/OpenSource.html + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is SNIA HBA API and IMA general header file + * + * The Initial Developer of the Original Code is: + * Benjamin F. Kuo, Troika Networks, Inc. (benk@troikanetworks.com) + * David Dillard VERITAS Software david.dillard@veritas.com + * + * Contributor(s): + * Jeff Ding, Adaptec, Inc. (jding@corp.adaptec.com) + * + ******************************************************************************* + * + * Changes: + * 09/24/2003 Initial Draft + * (for other changes... see the CVS logs) + * 12/15/2003 corrected the defined parameter in IMA_SetPhbaIsnsDiscovery(). + * lower case the computer name as iscsi name in IMA_GenerateNodeName(). + ******************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef IMAPLUGIN_H +#define IMAPLUGIN_H + +typedef IMA_STATUS (* Initialize)( + IMA_UINT32 pluginOid + ); + +typedef void (* TerminateFn)(); + + +typedef IMA_STATUS (* IMA_GetPluginPropertiesFn)( + IMA_OID pluginOid, + IMA_PLUGIN_PROPERTIES *pProps +); + + +typedef IMA_STATUS (* IMA_GetSharedNodeOidFn)( + IMA_OID *pSharedNodeId +); + + +typedef IMA_STATUS (* IMA_GetNodePropertiesFn)( + IMA_OID nodeOid, + IMA_NODE_PROPERTIES *pProps +); + + +typedef IMA_STATUS (* IMA_SetNodeNameFn)( + IMA_OID nodeOid, + const IMA_NODE_NAME newName +); + + +typedef IMA_STATUS (* IMA_GenerateNodeNameFn)( + IMA_NODE_NAME generatedname +); + + +typedef IMA_STATUS (* IMA_SetNodeAliasFn)( + IMA_OID nodeOid, + const IMA_NODE_ALIAS newAlias +); + + +typedef IMA_STATUS (* IMA_GetLhbaOidListFn)( + IMA_OID_LIST **ppList +); + +typedef IMA_STATUS (* IMA_GetLhbaPropertiesFn)( + IMA_OID lhbaId, + IMA_LHBA_PROPERTIES *pProps +); + + +typedef IMA_STATUS (* IMA_GetPhbaOidListFn)( + IMA_OID_LIST **ppList +); + + +typedef IMA_STATUS (* IMA_GetPhbaPropertiesFn)( + IMA_OID phbaId, + IMA_PHBA_PROPERTIES *pProps +); + + +typedef IMA_STATUS (* IMA_GetNonSharedNodeOidListFn)( + IMA_OID_LIST **ppList + ); + + +typedef IMA_STATUS (* IMA_GetFirstBurstLengthPropertiesFn)( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps + ); + + +typedef IMA_STATUS (* IMA_GetMaxBurstLengthPropertiesFn)( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps + ); + + +typedef IMA_STATUS (* IMA_GetMaxRecvDataSegmentLengthPropertiesFn)( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps + ); + + +/*---------------------------------------------*/ +typedef IMA_STATUS (* IMA_PluginIOCtlFn)( + IMA_OID pluginOid, + IMA_UINT command, + const void *pInputBuffer, + IMA_UINT inputBufferLength, + void *pOutputBuffer, + IMA_UINT *pOutputBufferLength +); + + +typedef IMA_STATUS (* IMA_GetNetworkPortalOidListFn)( + IMA_OID lhbaId, + IMA_OID_LIST **ppList +); + + +typedef IMA_STATUS (* IMA_SetFirstBurstLengthFn)( + IMA_OID lhbaId, + IMA_UINT firstBurstLength +); + +typedef IMA_STATUS (* IMA_SetMaxBurstLengthFn)( + IMA_OID lhbaId, + IMA_UINT maxBurstLength +); + +typedef IMA_STATUS (* IMA_SetMaxRecvDataSegmentLengthFn)( + IMA_OID lhbaId, + IMA_UINT maxRecvDataSegmentLength +); + +typedef IMA_STATUS (* IMA_GetMaxConnectionsPropertiesFn)( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps +); + +typedef IMA_STATUS (* IMA_SetMaxConnectionsFn)( + IMA_OID lhbaId, + IMA_UINT maxConnections +); + +typedef IMA_STATUS (* IMA_GetDefaultTime2RetainPropertiesFn)( + IMA_OID lhbaId, + IMA_MIN_MAX_VALUE *pProps +); + +typedef IMA_STATUS (* IMA_SetDefaultTime2RetainFn)( + IMA_OID lhbaId, + IMA_UINT defaultTime2Retain +); + +typedef IMA_STATUS (* IMA_GetDefaultTime2WaitPropertiesFn)( + IMA_OID lhbaId, + IMA_MIN_MAX_VALUE *pProps +); + +typedef IMA_STATUS (* IMA_SetDefaultTime2WaitFn)( + IMA_OID lhbaId, + IMA_UINT defaultTime2Wait +); + +typedef IMA_STATUS (* IMA_GetMaxOutstandingR2TPropertiesFn)( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps +); + +typedef IMA_STATUS (* IMA_SetMaxOutstandingR2TFn)( + IMA_OID lhbaId, + IMA_UINT maxOutstandingR2T +); + +typedef IMA_STATUS (* IMA_GetErrorRecoveryLevelPropertiesFn)( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps +); + +typedef IMA_STATUS (* IMA_SetErrorRecoveryLevelFn)( + IMA_OID Oid, + IMA_UINT errorRecoveryLevel +); + +typedef IMA_STATUS (* IMA_GetInitialR2TPropertiesFn)( + IMA_OID Oid, + IMA_BOOL_VALUE *pProps +); + +typedef IMA_STATUS (* IMA_SetInitialR2TFn)( + IMA_OID Oid, + IMA_BOOL initialR2T +); + +typedef IMA_STATUS (* IMA_GetImmediateDataPropertiesFn)( + IMA_OID Oid, + IMA_BOOL_VALUE *pProps +); + +typedef IMA_STATUS (* IMA_SetImmediateDataFn)( + IMA_OID Oid, + IMA_BOOL immediateData +); + +typedef IMA_STATUS (* IMA_GetDataPduInOrderPropertiesFn)( + IMA_OID Oid, + IMA_BOOL_VALUE *pProps +); + +typedef IMA_STATUS (* IMA_SetDataPduInOrderFn)( + IMA_OID Oid, + IMA_BOOL dataPduInOrder +); + +typedef IMA_STATUS (* IMA_GetDataSequenceInOrderPropertiesFn)( + IMA_OID Oid, + IMA_BOOL_VALUE *pProps +); + +typedef IMA_STATUS (* IMA_SetDataSequenceInOrderFn)( + IMA_OID Oid, + IMA_BOOL dataSequenceInOrder +); + +typedef IMA_STATUS (* IMA_SetStatisticsCollectionFn)( + IMA_OID Oid, + IMA_BOOL enableStatisticsCollection +); + +typedef IMA_STATUS (* IMA_GetNetworkPortStatusFn)( + IMA_OID portOid, + IMA_NETWORK_PORT_STATUS *pStatus +); + +typedef IMA_STATUS (* IMA_GetTargetOidListFn)( + IMA_OID Oid, + IMA_OID_LIST **ppList +); + +typedef IMA_STATUS (* IMA_RemoveStaleDataFn)( + IMA_OID lhbaId +); + +typedef IMA_STATUS (* IMA_SetIsnsDiscoveryFn)( + IMA_OID phbaId, + IMA_BOOL enableIsnsDiscovery, + IMA_ISNS_DISCOVERY_METHOD discoveryMethod, + const IMA_HOST_ID *iSnsHost +); + +typedef IMA_STATUS (* IMA_SetSlpDiscoveryFn)( + IMA_OID phbaId, + IMA_BOOL enableSlpDiscovery +); + +typedef IMA_STATUS (* IMA_SetStaticDiscoveryFn)( + IMA_OID phbaId, + IMA_BOOL enableStaticDiscovery +); + +typedef IMA_STATUS (* IMA_SetSendTargetsDiscoveryFn)( + IMA_OID phbaId, + IMA_BOOL enableSendTargetsDiscovery +); + +typedef IMA_STATUS (* IMA_AddPhbaStaticDiscoveryTargetFn)( + IMA_OID phbaOid, + const IMA_TARGET_ADDRESS targetAddress, + IMA_OID_LIST **pTargetOidList +); + +typedef IMA_STATUS (* IMA_RemovePhbaStaticDiscoveryTargetFn)( + IMA_OID phbaOid, + IMA_OID targetOid +); + +typedef IMA_STATUS (* IMA_GetPnpOidListFn)( + IMA_OID Oid, + IMA_OID_LIST **ppList +); + +typedef IMA_STATUS (* IMA_GetPhbaDownloadPropertiesFn)( + IMA_OID phbaId, + IMA_PHBA_DOWNLOAD_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_IsPhbaDownloadFileFn)( + IMA_OID phbaId, + const IMA_WCHAR *pFileName, + IMA_PHBA_DOWNLOAD_IMAGE_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_PhbaDownloadFn)( + IMA_OID phbaId, + IMA_PHBA_DOWNLOAD_IMAGE_TYPE imageType, + const IMA_WCHAR *pFileName +); + +typedef IMA_STATUS (* IMA_GetNetworkPortalPropertiesFn)( + IMA_OID networkPortalId, + IMA_NETWORK_PORTAL_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_SetNetworkPortalIpAddressFn)( + IMA_OID networkPortalId, + const IMA_IP_ADDRESS NewIpAddress +); + +typedef IMA_STATUS (* IMA_GetLnpOidListFn)( + IMA_OID_LIST **ppList +); + +typedef IMA_STATUS (* IMA_GetLnpPropertiesFn)( + IMA_OID lnpId, + IMA_LNP_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_GetPnpPropertiesFn)( + IMA_OID pnpId, + IMA_PNP_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_GetPnpStatisticsFn)( + IMA_OID pnpId, + IMA_PNP_STATISTICS *pStats +); + +typedef IMA_STATUS (* IMA_GetConnectionPropertiesFn)( + IMA_OID connectionId, + IMA_CONNECTION_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_GetTargetPropertiesFn)( + IMA_OID targetId, + IMA_TARGET_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_GetSessionPropertiesFn)( + IMA_OID sessionId, + IMA_SESSION_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_GetTargetErrorStatisticsFn)( + IMA_OID targetId, + IMA_TARGET_ERROR_STATISTICS *pStats +); + +typedef IMA_STATUS (* IMA_GetLuOidListFn)( + IMA_OID Oid, + IMA_OID_LIST **ppList +); + +typedef IMA_STATUS (* IMA_GetLuOidFn)( + IMA_OID targetId, + IMA_UINT64 lun, + IMA_OID *pluId +); + +typedef IMA_STATUS (* IMA_GetLuPropertiesFn)( + IMA_OID luId, + IMA_LU_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_GetStatisticsPropertiesFn)( + IMA_OID oid, + IMA_STATISTICS_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_GetDeviceStatisticsFn)( + IMA_OID luId, + IMA_DEVICE_STATISTICS *pStats +); + +typedef IMA_STATUS (* IMA_LuInquiryFn)( + IMA_OID deviceId, + IMA_BOOL evpd, + IMA_BOOL cmddt, + IMA_BYTE pageCode, + + IMA_BYTE *pOutputBuffer, + IMA_UINT *pOutputBufferLength, + + IMA_BYTE *pSenseBuffer, + IMA_UINT *pSenseBufferLength +); + +typedef IMA_STATUS (* IMA_LuReadCapacityFn)( + IMA_OID deviceId, + IMA_UINT cdbLength, + IMA_BYTE *pOutputBuffer, + IMA_UINT *pOutputBufferLength, + + IMA_BYTE *pSenseBuffer, + IMA_UINT *pSenseBufferLength +); + +typedef IMA_STATUS (* IMA_LuReportLunsFn)( + IMA_OID deviceId, + IMA_BOOL sendToWellKnownLun, + IMA_BYTE selectReport, + + IMA_BYTE *pOutputBuffer, + IMA_UINT *pOutputBufferLength, + + IMA_BYTE *pSenseBuffer, + IMA_UINT *pSenseBufferLength +); + +typedef IMA_STATUS (* IMA_ExposeLuFn)( + IMA_OID luId +); + +typedef IMA_STATUS (* IMA_UnexposeLuFn)( + IMA_OID luId +); + +typedef IMA_STATUS (* IMA_GetPhbaStatusFn)( + IMA_OID hbaId, + IMA_PHBA_STATUS *pStatus +); + +typedef IMA_STATUS (* IMA_RegisterForObjectVisibilityChangesFn) ( + IMA_OBJECT_VISIBILITY_FN pClientFn +); + +typedef IMA_STATUS (* IMA_DeregisterForObjectVisibilityChangesFn) ( + IMA_OBJECT_VISIBILITY_FN pClientFn +); + +typedef IMA_STATUS (* IMA_RegisterForObjectPropertyChangesFn) ( + IMA_OBJECT_PROPERTY_FN pClientFn +); + +typedef IMA_STATUS (* IMA_DeregisterForObjectPropertyChangesFn) ( + IMA_OBJECT_PROPERTY_FN pClientFn +); + + +typedef IMA_STATUS (* IMA_GetAddressKeyPropertiesFn)( + IMA_OID targetOid, + IMA_ADDRESS_KEY_PROPERTIES **ppProps +); + +typedef IMA_STATUS (* IMA_GetIpPropertiesFn)( + IMA_OID oid, + IMA_IP_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_SetIpConfigMethodFn)( + IMA_OID oid, + IMA_BOOL enableDhcpIpConfiguration +); + +typedef IMA_STATUS (* IMA_SetSubnetMaskFn)( + IMA_OID oid, + IMA_IP_ADDRESS subnetMask +); + +typedef IMA_STATUS (* IMA_SetDnsServerAddressFn)( + IMA_OID oid, + const IMA_IP_ADDRESS *primaryDnsServerAddress, + const IMA_IP_ADDRESS *alternateDnsServerAddress +); + +typedef IMA_STATUS (* IMA_SetDefaultGatewayFn)( + IMA_OID oid, + IMA_IP_ADDRESS defaultGateway +); + +typedef IMA_STATUS (* IMA_GetSupportedAuthMethodsFn)( + IMA_OID lhbaOid, + IMA_BOOL getSettableMethods, + IMA_UINT *pMethodCount, + IMA_AUTHMETHOD *pMethodList +); + +typedef IMA_STATUS (* IMA_GetInUseInitiatorAuthMethodsFn)( + IMA_OID lhbaOid, + IMA_UINT *pMethodCount, + IMA_AUTHMETHOD *pMethodList +); + +typedef IMA_STATUS (* IMA_GetInitiatorAuthParmsFn)( + IMA_OID lhbaOid, + IMA_AUTHMETHOD method, + IMA_INITIATOR_AUTHPARMS *pParms +); + +typedef IMA_STATUS (* IMA_SetInitiatorAuthMethodsFn)( + IMA_OID lhbaOid, + IMA_UINT methodCount, + const IMA_AUTHMETHOD *pMethodList +); + +typedef IMA_STATUS (* IMA_SetInitiatorAuthParmsFn)( + IMA_OID lhbaOid, + IMA_AUTHMETHOD method, + const IMA_INITIATOR_AUTHPARMS *pParms +); + +typedef IMA_STATUS (* IMA_FreeMemoryFn)( + void *pMemory +); + +typedef IMA_STATUS (* IMA_GetStaticDiscoveryTargetOidListFn)( + IMA_OID oid, + IMA_OID_LIST **ppList +); + +typedef IMA_STATUS (* IMA_GetDiscoveryPropertiesFn)( + IMA_OID oid, + IMA_DISCOVERY_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_AddDiscoveryAddressFn)( + IMA_OID oid, + const IMA_TARGET_ADDRESS discoveryAddress, + IMA_OID *pDiscoveryAddressOid +); + +typedef IMA_STATUS (* IMA_AddStaticDiscoveryTargetFn)( + IMA_OID oid, + const IMA_STATIC_DISCOVERY_TARGET staticDiscoveryTarget, + IMA_OID *pStaticDiscoveryTargetOid +); + +typedef IMA_STATUS (* IMA_RemoveStaticDiscoveryTargetFn)( + IMA_OID oid +); + +typedef IMA_STATUS (* IMA_GetStaticDiscoveryTargetPropertiesFn)( + IMA_OID staticDiscoveryTargetOid, + IMA_STATIC_DISCOVERY_TARGET_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_GetDiscoveryAddressOidListFn) ( + IMA_OID Oid, + IMA_OID_LIST **ppList +); + +typedef IMA_STATUS (* IMA_GetSessionOidListFn) ( + IMA_OID Oid, + IMA_OID_LIST **ppList +); + +typedef IMA_STATUS (* IMA_GetConnectionOidListFn) ( + IMA_OID Oid, + IMA_OID_LIST **ppList +); + +typedef IMA_STATUS (* IMA_GetDiscoveryAddressPropertiesFn) ( + IMA_OID discoveryAddressOid, + IMA_DISCOVERY_ADDRESS_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_RemoveDiscoveryAddressFn) ( + IMA_OID discoveryAddressOid +); + +typedef IMA_STATUS (* IMA_GetIpsecPropertiesFn) ( + IMA_OID oid, + IMA_IPSEC_PROPERTIES *pProps +); + +typedef IMA_STATUS (* IMA_GetAddressKeysFn) ( + IMA_OID targetOid, + IMA_ADDRESS_KEYS **ppKeys +); + +typedef IMA_STATUS (* QIMA_SetUpdateIntervalFn)( + IMA_OID pluginOid, + time_t interval +); + +typedef IMA_STATUS (* IMA_CommitHbaParametersFn)( + IMA_OID oid, IMA_COMMIT_LEVEL commitLevel +); + +#endif + +#ifdef __cplusplus +} +#endif + diff --git a/usr/src/lib/libima/common/ima.conf b/usr/src/lib/libima/common/ima.conf new file mode 100644 index 0000000000..8378a62d9b --- /dev/null +++ b/usr/src/lib/libima/common/ima.conf @@ -0,0 +1,35 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# +# +# This file contains names and references to HBA libraries +# +# Format: +# +# <library name> <library pathname> +# +# The library name should be prepended with the domain of +# the manufacturer or driver author. + diff --git a/usr/src/lib/libima/common/ima.h b/usr/src/lib/libima/common/ima.h new file mode 100644 index 0000000000..24f7f58625 --- /dev/null +++ b/usr/src/lib/libima/common/ima.h @@ -0,0 +1,2434 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/****************************************************************************** + * + * Description + * Ima.h - general header file for client + * and library developers + * + * License: + * The contents of this file are subject to the SNIA Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * + * /http://www.snia.org/English/Resources/Code/OpenSource.html + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is SNIA HBA API and IMA general header file + * + * The Initial Developer of the Original Code is: + * Benjamin F. Kuo, Troika Networks, Inc. (benk@troikanetworks.com) + * David Dillard VERITAS Software david.dillard@veritas.com + * + * Contributor(s): + * Jeff Ding, Adaptec, Inc. (jding@corp.adaptec.com) + * Dave Wysochanski, Network Appliance, Inc. (davidw@netapp.com) + * + ****************************************************************************** + * + * Changes: + * 09/24/2003 Initial Draft + * (for other changes... see the CVS logs) + * 12/15/2003 corrected the defined parameter in IMA_SetPhbaIsnsDiscovery(). + * lower case the computer name as iscsi name in + * IMA_GenerateNodeName(). + * 03/01/2004 Brought up to date with respect to IMA v1.0.1; made formatting + * changes - lines to 80 cols - for readability. + * + * 01/21/2005 Updated to support IMA 1.1.3. + *****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef IMA_H +#define IMA_H + +#include <time.h> +#include <wchar.h> + + +/* Library version string */ +#define HBA_LIBVERSION 2 + +/* DLL imports for WIN32 operation */ +#ifdef WIN32 +#ifdef IMA_EXPORTS +#define IMA_API __declspec(dllexport) +#else +#define IMA_API __declspec(dllimport) +#endif +#else +#define IMA_API +#endif + +/* OS specific definitions */ + +#ifdef WIN32 +typedef unsigned char IMA_UINT8; // Unsigned 8 bits +typedef char IMA_INT8; // Signed 8 bits +typedef unsigned short IMA_UINT16; // Unsigned 16 bits +typedef short IMA_INT16; // Signed 16 bits +typedef unsigned int IMA_UINT32; // Unsigned 32 bits +typedef int IMA_INT32; // Signed 32 bits +typedef void* IMA_PVOID; // Pointer to void +typedef IMA_UINT32 IMA_VOID32; // Opaque 32 bits + + +/* Don't confuse, _WIN32 with WIN32... OK, how do you accompish that */ +#ifdef _WIN32 +typedef __int64 IMA_INT64; +typedef unsigned __int64 IMA_UINT64; +#else +typedef struct { + TN_UINT32 lo_val; + TN_UINT32 hi_val; +} IMA_INT64; + +typedef struct { + TN_UINT32 lo_val; + TN_UINT32 hi_val; +} IMA_UINT64; +#endif /* #ifdef _WIN32 */ + + +#else + +/* Note this section needs to be cleaned up for various Unix platforms */ +typedef unsigned char IMA_UINT8; /* Unsigned 8 bits */ +typedef char IMA_INT8; /* Signed 8 bits */ +typedef unsigned short IMA_UINT16; /* Unsigned 16 bits */ +typedef short IMA_INT16; /* Signed 16 bits */ +typedef unsigned int IMA_UINT32; /* Unsigned 32 bits */ +typedef int IMA_INT32; /* Signed 32 bits */ +typedef void* IMA_PVOID; /* Pointer to void */ +typedef IMA_UINT32 IMA_VOID32; /* Opaque 32 bits */ +typedef long long IMA_INT64; +typedef long long IMA_UINT64; + +#endif /* #ifdef WIN32 */ + + + +/** +******************************************************************************* +* +* Generic IMA Constant Definitions +* +******************************************************************************* +*/ +#define RL_LIBRARY_SEQNUM 0 +#define RL_SHARED_NODE_SEQNUM 0 + +/** +* Value which can be assigned to an IMA_BOOL and or an IMA_XBOOL. +*/ +#define IMA_TRUE 1 + +/** +* Value which can be assigned to an IMA_BOOL and or an IMA_XBOOL. +*/ +#define IMA_FALSE 0 + +/** +* Value which can be assigned to an IMA_XBOOL. +*/ +#define IMA_UNKNOWN 0xFFFFFFFF + + + +/** +******************************************************************************* +* +* Base IMA Type Definitions +* +* @note Types that have a specific size must be defined ImaOsTypes.h which is +* an OS specific include file which is included by this file. +* +******************************************************************************* +*/ + +/** +* A character. +*/ +typedef char IMA_CHAR; + +/** +* A wide character. +*/ +typedef wchar_t IMA_WCHAR; + +/** +* An integer. Spec states this is 32 bits on 32-bit systems, and 64-bit +* on 64-bit systems. +*/ +typedef unsigned long IMA_UINT; + +/** +* A boolean. +*/ +typedef IMA_UINT32 IMA_BOOL; + +/** +* An extended boolean: can have the values @ref IMA_TRUE, @ref IMA_FALSE, and +* @ref IMA_UNKNOWN. +*/ +typedef IMA_UINT32 IMA_XBOOL; + +/** +* A date and time. +*/ +typedef struct tm IMA_DATETIME; + +typedef unsigned char IMA_BYTE; + +/** +******************************************************************************* +* +* Constants and macros declarations related to IMA_STATUS +* +******************************************************************************* +*/ +#ifdef SOLARIS +typedef IMA_UINT IMA_STATUS; + +#define IMA_STATUS_SUCCESS 0x00000000 +#define IMA_STATUS_ERROR 0x80000000 + +#define IMA_SUCCESS(status) (((IMA_STATUS)(status) & \ + (IMA_STATUS)IMA_STATUS_ERROR) == 0 ? IMA_TRUE : IMA_FALSE) +#define IMA_ERROR(status) (((IMA_STATUS)(status) & \ + (IMA_STATUS)IMA_STATUS_ERROR) == 0x8000000 ? IMA_TRUE : IMA_FALSE) + +#define MAKE_IMA_STATUS(x) ((IMA_STATUS)(x)) +#define MAKE_IMA_ERROR(x) ((IMA_STATUS)(IMA_STATUS_ERROR | (x))) +#define GET_SYSTEM_ERROR(x) (((IMA_STATUS)(x) & 0x0000FFFF)) + +#define IMA_STATUS_REBOOT_NECESSARY MAKE_IMA_STATUS(0x01) +#define IMA_STATUS_INCONSISTENT_NODE_PROPERTIES MAKE_IMA_STATUS(0x02) +#define IMA_STATUS_SCSI_STATUS_CONDITION_MET MAKE_IMA_STATUS(0x100) + +#define IMA_ERROR_NOT_SUPPORTED MAKE_IMA_ERROR(0x01) +#define IMA_ERROR_INSUFFICIENT_MEMORY MAKE_IMA_ERROR(0x02) +#define IMA_ERROR_LAST_PRIMARY_DISCOVERY_METHOD MAKE_IMA_ERROR(0x03) +#define IMA_ERROR_UNEXPECTED_OS_ERROR MAKE_IMA_ERROR(0x04) +#define IMA_ERROR_SYNC_TIMEOUT MAKE_IMA_ERROR(0x05) +#define IMA_ERROR_LU_EXPOSED MAKE_IMA_ERROR(0x06) +#define IMA_ERROR_LU_NOT_EXPOSED MAKE_IMA_ERROR(0x07) +#define IMA_ERROR_LU_IN_USE MAKE_IMA_ERROR(0x08) +#define IMA_ERROR_TARGET_TIMEOUT MAKE_IMA_ERROR(0x09) +#define IMA_ERROR_LOGIN_REJECTED MAKE_IMA_ERROR(0x0A) +#define IMA_ERROR_STATS_COLLECTION_NOT_ENABLED MAKE_IMA_ERROR(0x0B) +#define IMA_ERROR_SCSI_STATUS_CHECK_CONDITION MAKE_IMA_ERROR(0x100) +#define IMA_ERROR_SCSI_STATUS_BUSY MAKE_IMA_ERROR(0x101) +#define IMA_ERROR_SCSI_STATUS_RESERVATION_CONFLICT MAKE_IMA_ERROR(0x102) +#define IMA_ERROR_SCSI_STATUS_TASK_SET_FULL MAKE_IMA_ERROR(0x103) +#define IMA_ERROR_SCSI_STATUS_ACA_ACTIVE MAKE_IMA_ERROR(0x104) +#define IMA_ERROR_SCSI_STATUS_TASK_ABORTED MAKE_IMA_ERROR(0x105) +#define IMA_ERROR_INVALID_PARAMETER MAKE_IMA_ERROR(0x40000000) +#define IMA_ERROR_INVALID_OBJECT_TYPE MAKE_IMA_ERROR(0x40000001) +#define IMA_ERROR_INCORRECT_OBJECT_TYPE MAKE_IMA_ERROR(0x40000002) +#define IMA_ERROR_OBJECT_NOT_FOUND MAKE_IMA_ERROR(0x40000003) +#define IMA_ERROR_NAME_TOO_LONG MAKE_IMA_ERROR(0x40000004) +#define IMA_ERROR_UNKNOWN_ERROR MAKE_IMA_ERROR(0x0fffffff) + +#else + +typedef enum { + IMA_STATUS_SUCCESS = 0x00000000, + IMA_STATUS_REBOOT_NECESSARY = 0x00000001, + IMA_STATUS_INCONSISTENT_NODE_PROPERTIES = 0x00000002, + IMA_STATUS_SCSI_STATUS_CONDITION_MET = 0x00000100, + + IMA_STATUS_ERROR = 0x80000000, + IMA_ERROR_NOT_SUPPORTED = 0x80000001, + IMA_ERROR_INSUFFICIENT_MEMORY = 0x80000002, + IMA_ERROR_LAST_PRIMARY_DISCOVERY_METHOD = 0x80000003, + IMA_ERROR_UNEXPECTED_OS_ERROR = 0x80000004, + IMA_ERROR_SYNC_TIMEOUT = 0x80000005, + IMA_ERROR_LU_EXPOSED = 0x80000006, + IMA_ERROR_LU_NOT_EXPOSED = 0x80000007, + IMA_ERROR_LU_IN_USE = 0x80000008, + IMA_ERROR_TARGET_TIMEOUT = 0x80000009, + IMA_ERROR_LOGIN_REJECTED = 0x8000000A, + IMA_ERROR_STATS_COLLECTION_NOT_ENABLED = 0x8000000B, + IMA_ERROR_SCSI_STATUS_CHECK_CONDITION = 0x80000100, + IMA_ERROR_SCSI_STATUS_BUSY = 0x80000101, + IMA_ERROR_SCSI_STATUS_RESERVATION_CONFLICT = 0x80000102, + IMA_ERROR_SCSI_STATUS_TASK_SET_FULL = 0x80000103, + IMA_ERROR_SCSI_STATUS_ACA_ACTIVE = 0x80000104, + IMA_ERROR_SCSI_STATUS_TASK_ABORTED = 0x80000105, + IMA_ERROR_INVALID_PARAMETER = 0xC0000000, + IMA_ERROR_INVALID_OBJECT_TYPE = 0xC0000001, + IMA_ERROR_INCORRECT_OBJECT_TYPE = 0xC0000002, + IMA_ERROR_OBJECT_NOT_FOUND = 0xC0000003, + IMA_ERROR_NAME_TOO_LONG = 0xC0000004, + IMA_ERROR_UNKNOWN_ERROR = 0x8FFFFFFF +} IMA_STATUS; + +/* +#define IMA_SUCCESS(status) ( (IMA_UINT32)(status) & \ + (IMA_UINT32)IMA_STATUS_ERROR == 0 ? \ + IMA_TRUE : IMA_FALSE ) +#define IMA_ERROR(status) ( (IMA_UINT32)(status) & \ + (IMA_UINT32)IMA_STATUS_ERROR == 0x8000000 ? \ + IMA_TRUE : IMA_FALSE ) +*/ + +#define IMA_SUCCESS(status) !((status) & IMA_STATUS_ERROR) +#define IMA_ERROR(status) ((status) & IMA_STATUS_ERROR) + +#endif + +/** +******************************************************************************* +* +* Declaration of the IMA_OBJECT_TYPE enumeration +* +******************************************************************************* +*/ +typedef enum +{ + IMA_OBJECT_TYPE_UNKNOWN = 0, + IMA_OBJECT_TYPE_PLUGIN = 1, + IMA_OBJECT_TYPE_NODE = 2, + IMA_OBJECT_TYPE_LHBA = 3, + IMA_OBJECT_TYPE_PHBA = 4, + IMA_OBJECT_TYPE_NETWORK_PORTAL = 5, + IMA_OBJECT_TYPE_PORTAL_GROUP = 6, + IMA_OBJECT_TYPE_LNP = 7, + IMA_OBJECT_TYPE_PNP = 8, + IMA_OBJECT_TYPE_TARGET = 9, + IMA_OBJECT_TYPE_LU = 10, + IMA_OBJECT_TYPE_DISCOVERY_ADDRESS = 11, + IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET = 12, + IMA_OBJECT_TYPE_CONNECTION = 13, + IMA_OBJECT_TYPE_SESSION = 14 +} IMA_OBJECT_TYPE; + +typedef enum +{ + IMA_ISNS_DISCOVERY_METHOD_STATIC = 0, + IMA_ISNS_DISCOVERY_METHOD_DHCP = 1, + IMA_ISNS_DISCOVERY_METHOD_SLP = 2 +} IMA_ISNS_DISCOVERY_METHOD; + +typedef enum +{ + IMA_DOWNLOAD_IMAGE_TYPE_FIRMWARE = 0, + IMA_DOWNLOAD_IMAGE_TYPE_OPTION_ROM = 1, + IMA_DOWNLOAD_IMAGE_TYPE_ALL = 2, + IMA_DOWNLOAD_IMAGE_TYPE_BOOTCODE = 3 +} IMA_PHBA_DOWNLOAD_IMAGE_TYPE; + +typedef enum +{ + IMA_PHBA_STATUS_WORKING = 0, + IMA_PHBA_STATUS_FAILED = 1 +} IMA_PHBA_STATUS; + +typedef enum +{ + IMA_NETWORK_PORT_STATUS_WORKING = 0, + IMA_NETWORK_PORT_STATUS_DEGRADED = 1, + IMA_NETWORK_PORT_STATUS_CRITICAL = 2, + IMA_NETWORK_PORT_STATUS_FAILED = 3, + IMA_NETWORK_PORT_STATUS_DISCONNECTED = 4 +} IMA_NETWORK_PORT_STATUS; + +typedef enum +{ + IMA_TARGET_DISCOVERY_METHOD_STATIC = 1, + IMA_TARGET_DISCOVERY_METHOD_SLP = 2, + IMA_TARGET_DISCOVERY_METHOD_ISNS = 4, + IMA_TARGET_DISCOVERY_METHOD_SENDTARGETS = 8 +} IMA_TARGET_DISCOVERY_METHOD; + +typedef enum +{ + IMA_AUTHMETHOD_NONE = 0, + IMA_AUTHMETHOD_CHAP = 1, + IMA_AUTHMETHOD_SRP = 2, + IMA_AUTHMETHOD_KRB5 = 3, + IMA_AUTHMETHOD_SPKM1 = 4, + IMA_AUTHMETHOD_SPKM2 = 5 +} IMA_AUTHMETHOD; + +typedef enum +{ + IMA_COMMIT_TYPE_AUTO = 0, + IMA_COMMIT_TYPE_ACTIVE, + IMA_COMMIT_TYPE_PERSISTENT, + IMA_COMMIT_TYPE_ACTIVE_AND_PERSISTENT, + IMA_COMMIT_TYPE_ALL_WITH_RESET +} IMA_COMMIT_LEVEL; + +typedef enum +{ + IMA_DIGEST_NONE = 0, + IMA_DIGEST_CRC32C = 1 +} IMA_DIGEST_TYPE; + + +/** +******************************************************************************* +* +* Declaration of the IMA_OID structure +* +* This structure should be treated as opaque by clients of the API. +* Appropriate APIs should be used to extract information from the structure. +* +******************************************************************************* +*/ +typedef struct _IMA_OID +{ + /** + * The type of the object. When an object ID is supplied as a parameter + * to an API the library uses this value to insure that the supplied + * object's type is appropriate for the API. + */ + IMA_OBJECT_TYPE objectType; + + /** + * A value determined by the library which it uses to uniquely identify the + * owner of an object. The owner of an object is either the library itself + * or a plugin. When an object ID is supplied as a parameter to an API the + * library uses this value to determine if it should handle the call itself + * or direct the call to one or more plugins. + */ + IMA_UINT32 ownerId; + + /** + * A value determined by a plugin which a plugin uses, perhaps in + * combination with the object type, to uniquely identify one of its + * objects. + */ + IMA_UINT64 objectSequenceNumber; + +} IMA_OID; + + + +/** +******************************************************************************* +* +* Declaration of the IMA_OID_LIST structure +* +* This structure is used by a number of APIs to return lists of objects. Any +* instance of this structure returned by an API must be freed by a client +* using the IMA_FreeObjectIdList API. Although oids is declared to be an +* array of one +* @ref IMA_OID structure it can in fact contain any number of +* @ref IMA_OID structures. +* +* @note The @a oids array is a variable length array, despite its declaration +* below it can be of any length. +* +******************************************************************************* +*/ +typedef struct _IMA_OID_LIST +{ + /** + * The number of object IDs in the @a oids array. + */ + IMA_UINT oidCount; + + /** + * A variable length array of zero or more object IDs. There are + * 'oidCount' object IDs in this array. + */ + IMA_OID oids[1]; + +} IMA_OID_LIST; + +#define IMA_HOST_NAME_LEN 256 +typedef IMA_WCHAR IMA_HOST_NAME[IMA_HOST_NAME_LEN]; +typedef IMA_BYTE IMA_MAC_ADDRESS[6]; + +/** +******************************************************************************* +* +* Declaration of the IMA_LIBRARY_PROPERTIES structure +* +******************************************************************************* +*/ +typedef struct _IMA_LIBRARY_PROPERTIES +{ + /** + * The version of the iSCSI Management API implemented by the library. + * The value returned by a library for the API as described in this + * document is one. + */ + IMA_UINT supportedImaVersion; + + /** + * A nul terminated ASCII string containing the name of the vendor that + * created the binary version of the library. + */ + IMA_WCHAR vendor[256]; + + /** + * A nul terminated ASCII string containing the implementation version + * of the library from the vendor specified in the 'vendor' field. + */ + IMA_WCHAR implementationVersion[256]; + + /** + * A nul terminated ASCII string ideally containing the path and file + * name of the library that is being used by the currently executing + * process can be found. If the path cannot be determined then it is + * acceptable to fill this field with only the name (and extension if + * applicable) of the file of the library. If this cannot be determined + * then this field should be an empty string. + */ + IMA_WCHAR fileName[256]; + + /** + * The time and date that the library that is executing was built. + */ + IMA_DATETIME buildTime; + + IMA_BYTE reserved[64]; +} IMA_LIBRARY_PROPERTIES; + + + +/** +******************************************************************************* +* +* Declaration of the IMA_PLUGIN_PROPERTIES structure +* +******************************************************************************* +*/ +typedef struct _IMA_PLUGIN_PROPERTIES +{ + IMA_UINT supportedImaVersion; + IMA_WCHAR vendor[256]; + IMA_WCHAR implementationVersion[256]; + IMA_WCHAR fileName[256]; + IMA_DATETIME buildTime; + + IMA_BOOL lhbasCanBeCreatedAndDestroyed; + + IMA_BYTE reserved[64]; + +} IMA_PLUGIN_PROPERTIES; + + +typedef struct _IMA_IP_ADDRESS +{ + IMA_BOOL ipv4Address; + IMA_BYTE ipAddress[16]; + +} IMA_IP_ADDRESS; + +typedef struct _IMA_ADDRESS_KEY +{ + IMA_IP_ADDRESS ipAddress; + IMA_UINT16 portNumber; + +} IMA_ADDRESS_KEY; + +typedef struct _IMA_ADDRESS_KEYS +{ + IMA_UINT addressKeyCount; + IMA_ADDRESS_KEY addressKeys[1]; + +} IMA_ADDRESS_KEYS; + +typedef struct _IMA_ADDRESS_KEY_PROPERTIES +{ + IMA_UINT addressKeyCount; + IMA_ADDRESS_KEY addressKeys[1]; + +} IMA_ADDRESS_KEY_PROPERTIES; + +typedef struct _IMA_IP_PROPERTIES +{ + IMA_BOOL ipConfigurationMethodSettable; + IMA_BOOL dhcpConfigurationEnabled; + + IMA_BOOL subnetMaskSettable; + IMA_BOOL subnetMaskValid; + IMA_IP_ADDRESS subnetMask; + + IMA_BOOL defaultGatewaySettable; + IMA_BOOL defaultGatewayValid; + IMA_IP_ADDRESS defaultGateway; + + IMA_BOOL primaryDnsServerAddressSettable; + IMA_BOOL primaryDnsServerAddressValid; + IMA_IP_ADDRESS primaryDnsServerAddress; + + IMA_BOOL alternateDnsServerAddressSettable; + IMA_BOOL alternateDnsServerAddressValid; + IMA_IP_ADDRESS alternateDnsServerAddress; + + IMA_BYTE reserved[64]; + +} IMA_IP_PROPERTIES; + +typedef struct _IMA_HOST_ID +{ + IMA_BOOL hostnameInUse; + union { + + IMA_HOST_NAME hostname; + IMA_IP_ADDRESS ipAddress; + + } id; + +} IMA_HOST_ID; + +typedef struct _IMA_TARGET_ADDRESS +{ + IMA_HOST_ID hostnameIpAddress; + IMA_UINT16 portNumber; + +} IMA_TARGET_ADDRESS; + +/** +******************************************************************************* +* +* Declaration of the IMA_NODE_NAME type +* +******************************************************************************* +*/ +#define IMA_NODE_NAME_LEN 224 +typedef IMA_WCHAR IMA_NODE_NAME[IMA_NODE_NAME_LEN]; + + + +/** +******************************************************************************* +* +* Declaration of the IMA_NODE_ALIAS type +* +******************************************************************************* +*/ +#define IMA_NODE_ALIAS_LEN 256 +typedef IMA_WCHAR IMA_NODE_ALIAS[IMA_NODE_ALIAS_LEN]; + + + +/** +******************************************************************************* +* +* Declaration of the IMA_DOMAIN_NAME type +* +* A variable of this type may be formatted in any of the following four ways: +* 1. An empty string, which indicates that no host or IP address is +* specified +* 2. A DNS host name +* 3. A dotted-decimal IPv4 address +* 4. A bracketed IPv6 address as specified in RFC 2732 +* +* In all cases a domain name is terminated by a nul character. +* This type is used by several APIs: IMA_SetPhbaSnsDiscovery(), +* IMA_SetNetworkPortalIpAddress(), and indirectly by +* IMA_GetPhbaDiscoveryProperties(). +* +******************************************************************************* +*/ +typedef wchar_t IMA_DOMAIN_NAME[256]; + +typedef struct _IMA_PHBA_DOWNLOAD_IMAGE_PROPERTIES +{ + IMA_PHBA_DOWNLOAD_IMAGE_TYPE imageType; + IMA_WCHAR version[32]; + IMA_WCHAR description[512]; + IMA_XBOOL upgrade; +} IMA_PHBA_DOWNLOAD_IMAGE_PROPERTIES; + + +/** +******************************************************************************* +* +* Declaration of the IMA_NODE_PROPERTIES structure +* +* This structure is returned by the IMA_GetNodeProperties() API. +* +* NOTE: It is possible for both 'runningInInitiatorMode' and +* 'runningInTargetMode' to be set to @c IMA_TRUE. This means that +* the node is operating both as an initiator and as a target. +* +******************************************************************************* +*/ +typedef struct _IMA_NODE_PROPERTIES +{ + /** + * A boolean indicating if the node is running as initiator or not. + */ + IMA_BOOL runningInInitiatorMode; + + /** + * A boolean indicating if the node is running as a target or not. + */ + IMA_BOOL runningInTargetMode; + + /** + * A boolean which indicates if the node's name is set or not. + */ + IMA_BOOL nameValid; + + /** + * A nul terminated Unicode string which contains the name of the node. + * The value in this field is only valid if 'nameValid' is set to + * IMA_TRUE, in which case it will be Unicode NULL terminated. If + * 'nameValid' is set to IMA_FALSE then this field will contain an + * empty string. + */ + IMA_NODE_NAME name; + + /** + * A boolean which indicates if the node's alias is set or not. + */ + IMA_BOOL aliasValid; + + /** + * A nul terminated Unicode string which contains the alias of the node. + * This field is only valid if 'aliasValid' is set to IMA_TRUE, in which + * case it will be Unicode NULL terminated. If 'aliasValid' is set to + * IMA_FALSE then this field will contain an empty string. + */ + IMA_NODE_ALIAS alias; + + /* + * Boolean indicating if both the name and alias are settable using + * IMA_SetNodeName() and IMA_SetNodeAlias(). + */ + IMA_BOOL nameAndAliasSettable; + + IMA_BYTE reserved[64]; + +} IMA_NODE_PROPERTIES; + + + +/** +******************************************************************************* +* +* Declaration of the IMA_LHBA_PROPERTIES structure +* +* This structure is returned by the IMA_GetLhbaProperties() API. +* +******************************************************************************* +*/ +typedef struct _IMA_LHBA_PROPERTIES +{ + IMA_WCHAR osDeviceName[256]; + IMA_BOOL luExposingSupported; + IMA_BOOL isDestroyable; + + IMA_BOOL staleDataRemovable; + IMA_UINT staleDataSize; + + IMA_BOOL initiatorAuthMethodsSettable; + IMA_BOOL targetAuthMethodsSettable; + + IMA_BYTE reserved[128]; +} IMA_LHBA_PROPERTIES; + + + +/** +******************************************************************************* +* +* Declaration of the IMA_ULP_xxx constants +* +******************************************************************************* +*/ +#define IMA_ULP_TCP 0x01 +#define IMA_ULP_SCTP 0x02 +#define IMA_ULP_UDP 0x04 + + + +/** +******************************************************************************* +* +* Declaration of the IMA_MIN_MAX_VALUE structure +* +* Note: If the 'currentValueValid' field is IMA_FALSE then the value of +* 'settable' must also be set to IMA_FALSE. +* +* Note: The fields in this structure contain values which are defined by the +* implementation and not by the iSCSI specification. It is possible +* that an implementation may be more or less restrictive in the values +* that it can accept than the iSCSI specification allows. +* +* Note: An example of how to use 'incrementValue': Suppose that a structure is +* obtained where 'currentValueValid' is IMA_TRUE, 'settable' is +* IMA_TRUE, 'currentValue' is 50, 'defaultValue' is 50, 'minimumValue' +* is 30, 'maximumValue' is 70 and 'incrementValue' is 10. In this case, +* the possible values that the property can be set to are 30, 40, 50, +* 60, and 70. The new value must be the current value plus or minus +* some multiple of 'incrementValue'. +* +******************************************************************************* +*/ +typedef struct _IMA_MIN_MAX_VALUE +{ + /** + * A boolean indicating if the @a currentValue field contains a valid value. + */ + IMA_BOOL currentValueValid; + + /** + * Indicates if the corresponding property is settable. If this field + * has the value IMA_TRUE then the 'defaultValue', 'minimumValue', + * 'maximumValue', and 'incrementValue' fields shall contain valid + * values. If this field has the value IMA_FALSE then these fields + * have undefined values. + */ + IMA_BOOL settable; + + /** + * If currentValueValid has the value IMA_TRUE then this field contains + * the current value of the associated property. If 'currentValueValid' has + * the value IMA_FALSE then the value of this field is undefined. + */ + IMA_UINT32 currentValue; + + /** + * If 'settable' has the value IMA_TRUE then this field contains the + * implementation's default value of the associated property. If 'settable' + * has the value IMA_FALSE then the value of this field is undefined. + */ + IMA_UINT32 defaultValue; + + /** + * If 'settable' has the value IMA_TRUE then this field contains the + * implementation's minimum value of the associated property. If 'settable' + * has the value IMA_FALSE then the value of this field is undefined. + */ + IMA_UINT32 minimumValue; + + /** + * If 'settable' has the value IMA_TRUE then this field contains the + * implementation's maximum value of the associated property. If 'settable' + * has the value IMA_FALSE then the value of this field is undefined. + */ + IMA_UINT32 maximumValue; + + /** + * If 'settable' has the value IMA_TRUE then this field contains a value + * which can be added to or subtracted from 'currentValue' to obtain other + * possible values of the associated property. If 'settable' has the value + * IMA_FALSE then the value of this field is undefined. + */ + IMA_UINT32 incrementValue; + +} IMA_MIN_MAX_VALUE; + +typedef struct _IMA_BOOL_VALUE +{ + IMA_BOOL currentValueValid; + IMA_BOOL settable; + IMA_BOOL currentValue; + IMA_BOOL defaultValue; +} IMA_BOOL_VALUE; + +/** +******************************************************************************* +* +* Declaration of the IMA_PHBA_PROPERTIES structure +* +* This structure is returned by the IMA_GetPhbaProperties() API. +* +* Note: Both 'isInitiator' and 'isTarget' cannot be set to IMA_FALSE as this +* would mean that the PHBA was not functioning as either an initiator or +* target, which means that its not functioning at all. +* +******************************************************************************* +*/ +typedef struct _IMA_PHBA_PROPERTIES +{ + /** + * A nul terminated ASCII string which contains the name of the vendor + * of a PHBA. If the first character in this field is nul then the + * vendor is unknown. + */ + IMA_WCHAR vendor[64]; + + /** + * A nul terminated ASCII string which contains the name of the model of + * a PHBA. If the first character in this field is nul then the model is + * unknown. + */ + IMA_WCHAR model[256]; + + /** + * A nul terminated ASCII string which contains a description of a PHBA. + * This is a user friendly description of the PHBA. If the first character + * in this field is nul then there is no description. + */ + IMA_WCHAR description[256]; + + /** + * A nul terminated ASCII string which contains the serial number of a + * PHBA. If the first character in this field is nul then the serial + * number is unknown. + */ + IMA_WCHAR serialNumber[64]; + + /** + * A nul terminated ASCII string which contains the hardware version of + * a PHBA. If the first character in this field is nul then the hardware + * version is unknown. + */ + IMA_WCHAR hardwareVersion[256]; + + /** + * A nul terminated ASCII string which contains the ASIC version of a + * PHBA. If the first character in this field is nul then the ASIC + * version is unknown or is not applicable. + */ + IMA_WCHAR asicVersion[256]; + + /** + * A nul terminated ASCII string which contains the firmware version of + * a PHBA. If the first character in this field is nul then the firmware + * version is unknown or is not applicable. + */ + IMA_WCHAR firmwareVersion[256]; + + /** + * A nul terminated ASCII string which contains the option ROM version + * of a PHBA. If the first character in this field is nul then the option + * ROM version is unknown or is not applicable. + */ + IMA_WCHAR optionRomVersion[256]; + + /** + * A nul terminated ASCII string which contains the name of the driver + * controlling a PHBA. If the first character in this field is nul then + * the name of the driver is unknown. + */ + IMA_WCHAR driverName[256]; + + /** + * A nul terminated ASCII string which contains the version of the driver + * specified in 'driverName'. If the first character in this field is nul + * then the version of the driver is unknown. + * + * This field can have a known value only if @a driverName has a known + * value as well. + */ + IMA_WCHAR driverVersion[256]; + + /** + * A field containing flags which indicate what upper level protocols + * are supported by a PHBA. Examples of upper level protocols include: + * + * - TCP, represented by IMA_ULP_TCP + * - SCTP, represented by IMA_ULP_SCTP + * - UDP, represented by IMA_ULP_UDP + */ + IMA_UINT supportedUlps; + + /** + * A extended boolean which indicates if a PHBA supports executing SCSI + * commands which cause bidirectional transfers. + * + * Note: The value of this field applies to the entire stack: + * the hardware, ASIC, firmware, driver, etc. All must support SCSI + * commands which cause bidirectional transfers for this field to be + * set to IMA_TRUE. + */ + IMA_XBOOL bidirectionalTransfersSupported; + + /** + * The maximum length, in bytes, of a CDB that can be transferred by + * this PHBA. If this field has a value of zero that indicates that + * this value is unknown. + * + * Note: The value of this field applies to the entire stack: + * the hardware, ASIC, firmware, driver, etc. All must support the + * maximum CDB length returned in this field. + */ + IMA_UINT maximumCdbLength; + + /** + * An extended boolean which indicates if a PHBA can also function as + * a standard NIC concurrently with functioning as an iSCSI PHBA. + */ + IMA_XBOOL canBeNic; + + /** + * A extended boolean which indicates if a PHBA is functioning as a + * standard NIC concurrently with functioning as an iSCSI PHBA. + */ + IMA_XBOOL isNic; + + /** + * An extended boolean indicating if the PHBA is functioning as an + * initiator. + */ + IMA_XBOOL isInitiator; + + /** + * An extended boolean indicating if the PHBA is functioning as a target. + */ + IMA_XBOOL isTarget; + + /** + * An extended boolean indicating if the PHBA is using a TCP offload engine. + * + * Note: This value should only be set to @c IMA_TRUE if a TCP offload + * engine is present and is being used. If it can be determined that a + * TCP offload engine is present, but it cannot be determined if that + * offload engine is being used then this value should be set to + * IMA_UNKNOWN. + */ + IMA_XBOOL usingTcpOffloadEngine; + + /** + * An extended boolean indicating if the PHBA is using a iSCSI offload + * engine. + * + * Note: This value should only be set to @c IMA_TRUE if a iSCSI offload + * engine is present and is being used. If it can be determined that an + * iSCSI offload engine is present, but it cannot be determined if that + * offload engine is being used then this value should be set to + * IMA_UNKNOWN. + */ + IMA_XBOOL usingIscsiOffloadEngine; + + IMA_BYTE reserved[128]; + +} IMA_PHBA_PROPERTIES; + +/** +******************************************************************************* +* +* Declaration of the IMA_DISCOVERY_PROPERTIES structure +* +******************************************************************************* +*/ +typedef struct _IMA_DISCOVERY_PROPERTIES +{ + IMA_BOOL iSnsDiscoverySettable; + IMA_XBOOL iSnsDiscoveryEnabled; + IMA_ISNS_DISCOVERY_METHOD iSnsDiscoveryMethod; + IMA_HOST_ID iSnsHost; + + IMA_BOOL slpDiscoverySettable; + IMA_XBOOL slpDiscoveryEnabled; + + IMA_BOOL staticDiscoverySettable; + IMA_XBOOL staticDiscoveryEnabled; + + IMA_BOOL sendTargetsDiscoverySettable; + IMA_XBOOL sendTargetsDiscoveryEnabled; + + IMA_BYTE reserved[128]; +} IMA_DISCOVERY_PROPERTIES; + + +typedef struct _IMA_PHBA_DOWNLOAD_PROPERTIES +{ + IMA_BOOL isPhbaDownloadFileSupported; + IMA_BOOL optionRomDownloadSupported; + IMA_BOOL firmwareDownloadSupported; + + IMA_BYTE reserved[32]; +} IMA_PHBA_DOWNLOAD_PROPERTIES; + +typedef struct _IMA_IPSEC_PROPERTIES +{ + IMA_BOOL ipsecSupported; + IMA_BOOL implementedInHardware; + IMA_BOOL implementedInSoftware; + + IMA_BYTE reserved[32]; + +} IMA_IPSEC_PROPERTIES; + +typedef struct _IMA_LNP_PROPERTIES +{ + IMA_MAC_ADDRESS macAddress; + IMA_BOOL macAddressSettable; + IMA_BYTE reserved[32]; + +} IMA_LNP_PROPERTIES; + +typedef struct _IMA_PNP_PROPERTIES +{ + IMA_OID associatedPhbaOid; + + IMA_MAC_ADDRESS macAddress; + IMA_BOOL macAddressSettable; + + IMA_UINT maximumTransferRate; + IMA_UINT currentTransferRate; + + IMA_UINT maximumFrameSize; + + IMA_BYTE reserved[64]; +} IMA_PNP_PROPERTIES; + +typedef struct _IMA_PNP_STATISTICS +{ + IMA_UINT64 bytesSent; + IMA_UINT32 pdusSent; + IMA_UINT64 bytesReceived; + IMA_UINT32 pdusReceived; + +} IMA_PNP_STATISTICS; + +typedef struct _IMA_TARGET_PROPERTIES +{ + IMA_OID associatedNodeOid; + IMA_OID associatedLhbaOid; + + IMA_NODE_NAME name; + IMA_NODE_ALIAS alias; + IMA_UINT32 discoveryMethodFlags; + + IMA_BOOL sendTargetsDiscoverySettable; + IMA_BOOL sendTargetsDiscoveryEnabled; + + IMA_BYTE reserved[128]; + +} IMA_TARGET_PROPERTIES; + +typedef struct _IMA_CONNECTION_PROPERTIES +{ + IMA_OID associatedSessionOid; + IMA_UINT16 connectionId; + IMA_DIGEST_TYPE dataDigest; + IMA_DIGEST_TYPE headerDigest; + IMA_BOOL ifMarker; + IMA_UINT32 ifMarkInt; + IMA_UINT32 maxRecvDataSegmentLength; + IMA_UINT32 maxTransmitDataSegmentLength; + IMA_BOOL ofMarker; + IMA_UINT32 ofMarkInt; +} IMA_CONNECTION_PROPERTIES; + + +typedef struct _IMA_SESSION_PROPERTIES +{ + IMA_OID associatedLhbaOid; + IMA_AUTHMETHOD authMethod; + IMA_BOOL dataPduInOrder; + IMA_BOOL dataSequenceInOrder; + IMA_UINT16 defaultTime2Retain; + IMA_UINT16 defaultTime2Wait; + IMA_UINT16 errorRecoveryLevel; + IMA_UINT32 firstBurstLength; + IMA_BOOL immediateData; + IMA_BOOL initialR2T; + IMA_BYTE isid[6]; + IMA_UINT32 maxBurstLength; + IMA_UINT16 maxConnections; + IMA_UINT16 maxOutstandingR2T; + IMA_UINT16 targetPortalGroupTag; + IMA_UINT16 tsih; +} IMA_SESSION_PROPERTIES; + + +typedef struct _IMA_TARGET_ERROR_STATISTICS +{ + IMA_BOOL loginFailedCountValid; + IMA_UINT32 loginFailedCount; + + IMA_BOOL sessionFailedCountValid; + IMA_UINT32 sessionFailedCount; + + IMA_BOOL headerOrDigestSessionFailedCountValid; + IMA_UINT32 headerOrDigestSessionFailedCount; + + IMA_BOOL timeLimitExceededSessionFailedCountValid; + IMA_UINT32 timeLimitExceededSessionFailedCount; + + IMA_BOOL formatErrorSessionFailedCountValid; + IMA_UINT32 formatErrorSessionFailedCount; + + IMA_BOOL closedConnectionDueToTimeoutCountValid; + IMA_UINT32 closedConnectionDueToTimeoutCount; + + IMA_BOOL lastLoginFailureTimeValid; + IMA_DATETIME lastLoginFailureTime; + + IMA_BYTE reserved[64]; + +} IMA_TARGET_ERROR_STATISTICS; + +typedef struct _IMA_LU_PROPERTIES +{ + IMA_OID associatedTargetOid; + IMA_UINT64 targetLun; + + IMA_BOOL exposedToOs; + IMA_DATETIME timeExposedToOs; + + IMA_BOOL osDeviceNameValid; + IMA_WCHAR osDeviceName[64]; + + IMA_BOOL osParallelIdsValid; + IMA_UINT32 osBusNumber; + IMA_UINT32 osTargetId; + IMA_UINT32 osLun; + + IMA_BYTE reserved[128]; + +} IMA_LU_PROPERTIES; + +typedef struct _IMA_STATISTICS_PROPERTIES +{ + IMA_BOOL statisticsCollectionSettable; + IMA_BOOL statisticsCollectionEnabled; + +} IMA_STATISTICS_PROPERTIES; + +typedef struct _IMA_DEVICE_STATISTICS +{ + IMA_UINT64 scsiPayloadBytesSent; + IMA_UINT64 scsiPayloadBytesReceived; + + IMA_UINT64 iScsiPduBytesSent; + IMA_UINT64 iScsiPduBytesReceived; + + IMA_UINT64 iScsiPdusSent; + IMA_UINT64 iScsiPdusReceived; + + IMA_UINT64 millisecondsSpentSending; + IMA_UINT64 millisecondsSpentReceiving; + +} IMA_DEVICE_STATISTICS; + +typedef struct _IMA_NETWORK_PORTAL_PROPERTIES +{ + IMA_IP_ADDRESS ipAddress; + IMA_OID associatedLnp; + + IMA_BYTE reserved[32]; +} IMA_NETWORK_PORTAL_PROPERTIES; + +typedef void (* IMA_OBJECT_VISIBILITY_FN)( + IMA_BOOL becomingVisible, + IMA_OID oid +); + +typedef void (* IMA_OBJECT_PROPERTY_FN)( + IMA_OID oid +); + +typedef struct _IMA_CHAP_INITIATOR_AUTHPARMS +{ + + IMA_UINT retries; + + IMA_BYTE name[512]; + IMA_UINT nameLength; + + IMA_UINT minValueLength; + IMA_UINT maxValueLength; + + IMA_BYTE challengeSecret[256]; + IMA_UINT challengeSecretLength; + + IMA_BYTE reserved[512]; + +} IMA_CHAP_INITIATOR_AUTHPARMS; + +typedef struct _IMA_SRP_INITIATOR_AUTHPARMS +{ + + IMA_BYTE userName[512]; + IMA_UINT userNameLength; + + IMA_BYTE reserved[512]; + +} IMA_SRP_INITIATOR_AUTHPARMS; + +typedef struct _IMA_KRB5_INITIATOR_AUTHPARMS +{ + + IMA_BYTE clientKey[1024]; + IMA_UINT clientKeyLength; + + IMA_BYTE reserved[2048]; + +} IMA_KRB5_INITIATOR_AUTHPARMS; + +typedef struct _IMA_SPKM_INITIATOR_AUTHPARMS +{ + + IMA_BYTE privateKey[4096]; + IMA_UINT privateKeyLength; + + IMA_BYTE publicKey[4096]; + IMA_UINT publicKeyLength; + + IMA_BYTE reserved[4096]; + +} IMA_SPKM_INITIATOR_AUTHPARMS; + +typedef union _IMA_INITIATOR_AUTHPARMS +{ + + IMA_CHAP_INITIATOR_AUTHPARMS chapParms; + IMA_SRP_INITIATOR_AUTHPARMS srpParms; + IMA_KRB5_INITIATOR_AUTHPARMS kerberosParms; + IMA_SPKM_INITIATOR_AUTHPARMS spkmParms; + +} IMA_INITIATOR_AUTHPARMS; + + +typedef struct _IMA_STATIC_DISCOVERY_TARGET +{ + IMA_NODE_NAME targetName; + IMA_TARGET_ADDRESS targetAddress; + +} IMA_STATIC_DISCOVERY_TARGET; + +typedef struct _IMA_DISCOVERY_ADDRESS_PROPERTIES +{ + IMA_OID associatedNodeOid; + IMA_OID associatedLhbaOid; + IMA_TARGET_ADDRESS discoveryAddress; + +} IMA_DISCOVERY_ADDRESS_PROPERTIES; + +typedef struct _IMA_STATIC_TGT_PROPERTIES +{ + IMA_OID associatedNodeOid; + IMA_OID associatedLhbaOid; + IMA_STATIC_DISCOVERY_TARGET staticTarget; + +} IMA_STATIC_DISCOVERY_TARGET_PROPERTIES; + + +/** +******************************************************************************* +* +* The individual APIs of the IMA are declared below. +* +******************************************************************************* +*/ + +/** +******************************************************************************* +* +* Gets the properties of the IMA library that is being used. +* +* @param pProps +* A pointer to an IMA_LIBRARY_PROPERTIES structure allocated by +* the caller. On successful return this structure will contain the +* properties of the IMA library. +* +* @return An IMA_STATUS indicating if the operation was successful or if +* an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the library properties were successfully returned. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'pProps' is NULL or specifies a memory area to which +* data cannot be written. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetLibraryProperties( + IMA_LIBRARY_PROPERTIES *pProps +); + + + +/** +******************************************************************************* +* +* Gets a list of the object IDs of all currently loaded plugins. +* +* @param ppList +* A pointer to a pointer to an IMA_OID_LIST. On successful +* return this will contain a pointer to an @ref IMA_OID_LIST +* which contains the object IDs of all of the plugins currently +* loaded by the library. +* +* @return An IMA_STATUS indicating if the operation was successful or +* if an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the plugin ID list was successfully returned. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'ppList' is NULL or specifies a memory area to +* which data cannot be written. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetPluginOidList( + IMA_OID_LIST **ppList +); + + + +/** +******************************************************************************* +* +* Gets the properties of the specified vendor plugin. +* +* @param pluginOid +* The ID of the plugin whose properties are being retrieved. +* +* @param pProps +* A pointer to an @ref IMA_PLUGIN_PROPERTIES structure allocated by +* the caller. On successful return this will contain the properties +* of the plugin specified by pluginOid. +* +* @return An IMA_STATUS indicating if the operation was successful or if an +* error occurred. +* +* @retval IMA_SUCCESS +* Returned if the plugin properties were successfully returned. +* +* @retval IMA_ERROR_INVALID_OBJECT_TYPE +* Returned if 'pluginOid' does not specify any valid object type. +* +* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE +* Returned if 'pluginOid' does not specify a plugin object. +* +* @retval IMA_ERROR_OBJECT_NOT_FOUND +* Returned if 'pluginOid' refers to a plugin, but not one that +* is currently loaded. +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'pProps' is NULL or specifies a memory area to +* which data cannot be written. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetPluginProperties( + IMA_OID pluginOid, + IMA_PLUGIN_PROPERTIES *pProps +); + + + +/** +******************************************************************************* +* +* Gets the object ID for the plugin associated with the specified object ID. +* +* @param oid +* The object ID of an object that has been received from a previous +* library call. +* +* @param pPluginOid +* A pointer to an IMA_OID structure allocated by the caller. On +* successful return this will contain the object ID of the plugin +* associated with the object specified by @a objectId. This +* can then be used to work with the plugin, e.g., to get the +* properties of the plugin or the send the plugin an IOCtl. +* +* @return An IMA_STATUS indicating if the operation was successful or if +* an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the associated plugin ID was successfully returned. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'pPluginOid' is NULL or specifies a memory area to +* which data cannot be written. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'oid' specifies an object not owned by a plugin, but +* instead one that is owned by the library. +* +* @retval IMA_ERROR_INVALID_OBJECT_TYPE +* Returned if 'oid' specifies an object with an invalid type. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetAssociatedPluginOid( + IMA_OID oid, + IMA_OID *pPluginOid +); + + + +/** +******************************************************************************* +* +* Gets the object ID of the shared node. +* +* @param pSharedNodeOid +* A pointer to an IMA_OID structure allocated by the caller. On +* successful return it will contain the object ID of the +* shared node of the currently executing system is placed. +* +* @return An IMA_STATUS indicating if the operation was successful or +* if an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the shared node ID has been successfully retrieved. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'pSharedNodeOid' is NULL or specifies a memory area +* to which data cannot be written. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetSharedNodeOid( + IMA_OID *pSharedNodeOid +); + +IMA_API IMA_STATUS IMA_GetObjectType( + IMA_OID oid, + IMA_OBJECT_TYPE *pObjectType +); + + +/** +******************************************************************************* +* +* Gets the properties of the specified iSCSI node. +* +* @param nodeOid +* The ID of the node to get the properties of. +* +* @param pProps +* A pointer to an @ref IMA_NODE_PROPERTIES structure which on +* successful return will contain the properties of the specified node. +* +* @return An IMA_STATUS indicating if the operation was successful or if +* an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the node properties have been successfully retrieved. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'pProps' is NULL or specifies a memory area to which +* data cannot be written. +* +* @retval IMA_ERROR_INVALID_OBJECT_TYPE +* Returned if 'nodeOid' does not specify any valid object type. +* +* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE +* Returned if 'nodeOid' does not specify a node object. +* +* @retval IMA_ERROR_OBJECT_NOT_FOUND +* Returned if 'nodeOid' does not specify a node which is currently +* known to the system. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetNodeProperties( + IMA_OID nodeOid, + IMA_NODE_PROPERTIES *pProps +); + + + +/** +******************************************************************************* +* +* Sets the name of the specified node. +* +* @param nodeOid +* The object ID of the node whose name is being set. +* +* @param newName +* The new name of the node. +* +* @return An IMA_STATUS indicating if the operation was successful or +* if an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the node name was successfully changed. +* +* @retval IMA_STATUS_REBOOT_NECESSARY +* Returned if a reboot is necessary before the setting of the +* name actually takes affect. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'newName' is NULL, or specifies a memory area +* to which data cannot be written, or has a length of 0. +* +* @retval IMA_ERROR_INVALID_OBJECT_TYPE +* Returned if 'nodeOid' does not specify any valid object type. +* +* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE +* Returned if 'nodeOid' does not specify a node object. +* +* @retval IMA_ERROR_OBJECT_NOT_FOUND +* Returned if 'nodeOid' does not specify a node which is +* currently known to the system. +* +* @retval IMA_ERROR_NAME_TOO_LONG +* Returned if 'newName' contains too many characters. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_SetNodeName( + IMA_OID nodeOid, + const IMA_NODE_NAME newName +); + + + +/** +******************************************************************************* +* +* Generates a unique node name for the currently running system. +* +* @param generatedName +* On successful return contains the generated node name. +* +* @return An IMA_STATUS indicating if the operation was successful or if an +* error occurred. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'generatedname is NULL or +* specifies a memory area to which data cannot be written. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GenerateNodeName( + IMA_NODE_NAME generatedName +); + + + +/** +******************************************************************************* +* +* Sets the alias of the specified node. +* +* @param nodeOid +* The object ID of the node whose alias is being set. +* +* @param newAlias +* A pointer to a Unicode string which contains the new node alias. +* If this parameter is NULL then the current alias is deleted, in which +* case the specified node no longer has an alias. +* +* @return An IMA_STATUS indicating if the operation was successful or +* if an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the node's alias has been successfully set. +* +* @retval IMA_STATUS_REBOOT_NECESSARY +* A reboot is necessary before the setting of the alias actually +* takes effect. +* +* @retval IMA_ERROR_INVALID_OBJECT_TYPE +* Returned if 'nodeOid' does not specify any valid object type. +* +* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE +* Returned if 'nodeOid' does not specify a node object. +* +* @retval IMA_ERROR_OBJECT_NOT_FOUND +* Returned if 'nodeOid' does not specify a node which is currently +* known to the system. +* +* @retval IMA_ERROR_NAME_TOO_LONG +* Returned if 'newAlias' contains too many characters. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_SetNodeAlias( + IMA_OID nodeOid, + const IMA_NODE_ALIAS newAlias +); + + + +/** +******************************************************************************* +* +* Gets a list of the object IDs of all the logical HBAs in the system. +* +* @param ppList +* A pointer to a pointer to an @ref IMA_OID_LIST structure. On +* successful return this will contain a pointer to an +* IMA_OID_LIST which contains the object IDs of all of the +* LHBAs currently in the system. +* +* @return An IMA_STATUS indicating if the operation was successful or if +* an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the LHBA ID list has been successfully returned. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'ppList' is NULL or specifies a memory area to which +* data cannot be written. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetLhbaOidList( + IMA_OID_LIST **ppList +); + + + +/** +******************************************************************************* +* +* Gets the properties of the specified logical HBA. +* +* @param lhbaOid +* The object ID of the LHBA whose properties are being retrieved. +* +* @param pProps +* A pointer to an IMA_LHBA_PROPERTIES structure. On successful +* return this will contain the properties of the LHBA specified by +* 'lhbaOid'. +* +* @return An IMA_STATUS indicating if the operation was successful or if +* an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the properties of the specified LHBA have been +* successfully retrieved. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'pProps' is NULL or specifies a memory area to which +* data cannot be written. +* +* @retval IMA_ERROR_INVALID_OBJECT_TYPE +* Returned if 'lhbaOid' does not specify any valid object type. +* +* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE +* Returned if 'lhbaOid' does not specify a LHBA. +* +* @retval IMA_ERROR_OBJECT_NOT_FOUND +* Returned if 'lhbaOid' does not specify a LHBA which is currently +* known to the system. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetLhbaProperties( + IMA_OID lhbaOid, + IMA_LHBA_PROPERTIES *pProps +); + + + +/** +******************************************************************************* +* +* Gets a list of the object IDs of all the physical HBAs in the system. +* +* @param ppList +* A pointer to a pointer to an IMA_OID_LIST structure. On successful +* return this will contain a pointer to an IMA_OID_LIST which +* contains the object IDs of all of the PHBAs currently in the system. +* +* @return An IMA_STATUS indicating if the operation was successful or if +* an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the PHBA OID list has been successfully returned. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'ppList' is NULL or specifies a memory area to which +* data cannot be written. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetPhbaOidList( + IMA_OID_LIST **ppList +); + + + +/** +******************************************************************************* +* +* Gets the general properties of a physical HBA. +* +* @param phbaOid +* The object ID of the PHBA whose properties are being queried. +* +* @param pProps +* A pointer to an @ref IMA_PHBA_PROPERTIES structure. On successful +* return this will contain the properties of the PHBA specified by +* 'phbaOid'. +# +* @return An IMA_STATUS indicating if the operation was successful or +* if an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the properties of the specified PHBA have been +* successfully retrieved. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'pProps' is NULL or specifies a memory area to which +* data cannot be written. +* +* @retval IMA_ERROR_INVALID_OBJECT_TYPE +* Returned if 'phbaOid' does not specify any valid object type. +* +* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE +* Returned if 'phbaOid' does not specify a PHBA. +* +* @retval IMA_ERROR_OBJECT_NOT_FOUND +* Returned if 'phbaOid' does not specify a PHBA which is currently +* known to the system. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetPhbaProperties( + IMA_OID phbaOid, + IMA_PHBA_PROPERTIES *pProps +); + +/** +******************************************************************************* +* +* Frees a previously allocated IMA_OID_LIST structure. +* +* @param pMemory A pointer to an IMA_OID_LIST structure allocated by the +* library. On successful return the memory allocated by the +* list is freed. +* @return An IMA_STATUS indicating if the operation was successful or if an +* error occurred. +* @retval IMA_SUCCESS +* Returned if the specified object ID list was successfully +* freed. +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if pMemory is NULL or specifies a memory area from which +* data cannot be read. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_FreeMemory( + void *pMemory +); + + + +IMA_API IMA_STATUS IMA_GetNonSharedNodeOidList( + IMA_OID_LIST **ppList +); + + + + +/** +******************************************************************************* +* +* Gets the first burst length properties of the specified logical HBA. +* +* @param oid +* The object ID of the logical HBA to get the first burst length +* properties of. +* +* @param pProps +* A pointer to a min/max values structure. +* +* @return An IMA_STATUS indicating if the operation was successful or if an +* error occurred. +* +* @retval IMA_SUCCESS +* Returned if the first burst length properties have been +* successfully retrieved. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if pProps is NULL or specifies a memory area to which +* data cannot be written. +* +* @retval IMA_ERROR_INVALID_OBJECT_TYPE +* Returned if 'oid' does not specify any valid object type. +* +* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE +* Returned if 'oid' does not specify a LHBA. +* +* @retval IMA_ERROR_OBJECT_NOT_FOUND +* Returned if 'oid' does not specify a LHBA which is currently +* known to the system. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetFirstBurstLengthProperties( + IMA_OID oid, + IMA_MIN_MAX_VALUE *pProps +); + + +/** +******************************************************************************* +* +* Gets the max burst length properties of the specified logical HBA. +* +* @param oid +* The object ID of the logical HBA to get the max burst length +* properties of. +* +* @param pProps +* A pointer to an IMA_MIN_MAX_VALUE structure allocated by the +* caller. On successful return this structure will contain the max +* burst length properties of this LHBA. +* +* @return An IMA_STATUS indicating if the operation was successful or if +* an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the max burst length properties have been successfully +* retrieved. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if pProps is NULL or specifies a memory area to which +* data cannot be written. +* +* @retval IMA_ERROR_INVALID_OBJECT_TYPE +* Returned if 'oid' does not specify any valid object type. +* +* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE +* Returned if 'oid' does not specify a LHBA. +* +* @retval IMA_ERROR_OBJECT_NOT_FOUND +* Returned if 'oid' does not specify a LHBA which is currently +* known to the system. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetMaxBurstLengthProperties( + IMA_OID Oid, + IMA_MIN_MAX_VALUE *pProps +); + +/** +******************************************************************************* +* +* Gets the maximum receive data segment length properties of the specified +* logical HBA. +* +* @param oid +* The object ID of the logical HBA to get the max receive data +* segment length properties of. +* +* @param pProps +* A pointer to an @ref IMA_MIN_MAX_VALUE structure allocated by the +* caller. On successful return this structure will contain the max +* receive data segment length properties of this LHBA. +* +* @return An IMA_STATUS indicating if the operation was successful or if +* an error occurred. +* +* @retval IMA_SUCCESS +* Returned if the max receive data segment length properties +* have been successfully retrieved. +* +* @retval IMA_ERROR_INVALID_PARAMETER +* Returned if 'pProps' is NULL or specifies a memory area to which +* data cannot be written. +* +* @retval IMA_ERROR_INVALID_OBJECT_TYPE +* Returned if 'oid' does not specify any valid object type. +* +* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE +* Returned if 'oid' does not specify a LHBA. +* +* @retval IMA_ERROR_OBJECT_NOT_FOUND +* Returned if 'oid' does not specify a LHBA which is currently +* known to the system. +* +******************************************************************************* +*/ +IMA_API IMA_STATUS IMA_GetMaxRecvDataSegmentLengthProperties( + IMA_OID oid, + IMA_MIN_MAX_VALUE *pProps +); + + +/*---------------------------------------------*/ +IMA_API IMA_STATUS IMA_PluginIOCtl( + IMA_OID pluginOid, + IMA_UINT command, + const void *pInputBuffer, + IMA_UINT inputBufferLength, + void *pOutputBuffer, + IMA_UINT *pOutputBufferLength +); + + + +IMA_API IMA_STATUS IMA_GetNetworkPortalOidList( + IMA_OID oid, + IMA_OID_LIST **ppList +); + +IMA_API IMA_STATUS IMA_SetFirstBurstLength( + IMA_OID oid, + IMA_UINT firstBurstLength +); + +IMA_API IMA_STATUS IMA_SetMaxBurstLength( + IMA_OID oid, + IMA_UINT maxBurstLength +); + +IMA_API IMA_STATUS IMA_SetMaxRecvDataSegmentLength( + IMA_OID oid, + IMA_UINT maxRecvDataSegmentLength +); + +IMA_API IMA_STATUS IMA_GetMaxConnectionsProperties( + IMA_OID oid, + IMA_MIN_MAX_VALUE *pProps +); + +IMA_API IMA_STATUS IMA_SetMaxConnections( + IMA_OID oid, + IMA_UINT maxConnections +); + +IMA_API IMA_STATUS IMA_GetDefaultTime2RetainProperties( + IMA_OID oid, + IMA_MIN_MAX_VALUE *pProps +); + +IMA_API IMA_STATUS IMA_SetDefaultTime2Retain( + IMA_OID oid, + IMA_UINT defaultTime2Retain +); + +IMA_API IMA_STATUS IMA_GetDefaultTime2WaitProperties( + IMA_OID oid, + IMA_MIN_MAX_VALUE *pProps +); + +IMA_API IMA_STATUS IMA_SetDefaultTime2Wait( + IMA_OID oid, + IMA_UINT defaultTime2Wait +); + +IMA_API IMA_STATUS IMA_GetMaxOutstandingR2TProperties( + IMA_OID oid, + IMA_MIN_MAX_VALUE *pProps +); + +IMA_API IMA_STATUS IMA_SetMaxOutstandingR2T( + IMA_OID oid, + IMA_UINT maxOutstandingR2T +); + +IMA_API IMA_STATUS IMA_GetErrorRecoveryLevelProperties( + IMA_OID oid, + IMA_MIN_MAX_VALUE *pProps +); + +IMA_API IMA_STATUS IMA_SetErrorRecoveryLevel( + IMA_OID oid, + IMA_UINT errorRecoveryLevel +); + +IMA_API IMA_STATUS IMA_GetInitialR2TProperties( + IMA_OID oid, + IMA_BOOL_VALUE *pProps +); + +IMA_API IMA_STATUS IMA_SetInitialR2T( + IMA_OID oid, + IMA_BOOL initialR2T +); + +IMA_API IMA_STATUS IMA_GetImmediateDataProperties( + IMA_OID oid, + IMA_BOOL_VALUE *pProps +); + +IMA_API IMA_STATUS IMA_SetImmediateData( + IMA_OID oid, + IMA_BOOL immediateData +); + +IMA_API IMA_STATUS IMA_GetDataPduInOrderProperties( + IMA_OID oid, + IMA_BOOL_VALUE *pProps +); + +IMA_API IMA_STATUS IMA_SetDataPduInOrder( + IMA_OID oid, + IMA_BOOL dataPduInOrder +); + +IMA_API IMA_STATUS IMA_GetDataSequenceInOrderProperties( + IMA_OID oid, + IMA_BOOL_VALUE *pProps +); + +IMA_API IMA_STATUS IMA_SetDataSequenceInOrder( + IMA_OID oid, + IMA_BOOL dataSequenceInOrder +); + +IMA_API IMA_STATUS IMA_SetStatisticsCollection( + IMA_OID oid, + IMA_BOOL enableStatisticsCollection +); + +IMA_API IMA_STATUS IMA_GetNetworkPortStatus( + IMA_OID portOid, + IMA_NETWORK_PORT_STATUS *pStatus +); + +IMA_API IMA_STATUS IMA_GetTargetOidList( + IMA_OID oid, + IMA_OID_LIST **ppList +); + +IMA_API IMA_STATUS IMA_RemoveStaleData( + IMA_OID lhbaOid +); + +IMA_API IMA_STATUS IMA_SetIsnsDiscovery( + IMA_OID phbaId, + IMA_BOOL enableIsnsDiscovery, + IMA_ISNS_DISCOVERY_METHOD discoveryMethod, + const IMA_HOST_ID *iSnsHost +); + +IMA_API IMA_STATUS IMA_SetSlpDiscovery( + IMA_OID phbaOid, + IMA_BOOL enableSlpDiscovery +); + +IMA_API IMA_STATUS IMA_SetStaticDiscovery( + IMA_OID phbaOid, + IMA_BOOL enableStaticDiscovery +); + +IMA_API IMA_STATUS IMA_SetSendTargetsDiscovery( + IMA_OID oid, + IMA_BOOL enableSendTargetsDiscovery +); + +IMA_API IMA_STATUS IMA_RemoveStaticDiscoveryTarget( + IMA_OID targetOid +); + +IMA_API IMA_STATUS IMA_GetIpsecProperties( + IMA_OID phbaOid, + IMA_IPSEC_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_GetPnpOidList( + IMA_OID oid, + IMA_OID_LIST **ppList +); + +IMA_API IMA_STATUS IMA_GetPhbaDownloadProperties( + IMA_OID phbaOid, + IMA_PHBA_DOWNLOAD_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_IsPhbaDownloadFile( + IMA_OID phbaOid, + const IMA_WCHAR *pFileName, + IMA_PHBA_DOWNLOAD_IMAGE_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_PhbaDownload( + IMA_OID phbaOid, + IMA_PHBA_DOWNLOAD_IMAGE_TYPE imageType, + const IMA_WCHAR *pFileName +); + +IMA_API IMA_STATUS IMA_GetNetworkPortalProperties( + IMA_OID networkPortalOid, + IMA_NETWORK_PORTAL_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_SetNetworkPortalIpAddress( + IMA_OID networkPortalOid, + const IMA_IP_ADDRESS NewIpAddress +); + +IMA_API IMA_STATUS IMA_GetLnpOidList( + IMA_OID_LIST **ppList +); + +IMA_API IMA_STATUS IMA_GetLnpProperties( + IMA_OID lnpOid, + IMA_LNP_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_GetPnpProperties( + IMA_OID pnpOid, + IMA_PNP_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_GetPnpStatistics( + IMA_OID pnpOid, + IMA_PNP_STATISTICS *pStats +); + +IMA_API IMA_STATUS IMA_GetTargetProperties( + IMA_OID targetOid, + IMA_TARGET_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_GetTargetErrorStatistics( + IMA_OID targetOid, + IMA_TARGET_ERROR_STATISTICS *pStats +); + +IMA_API IMA_STATUS IMA_GetLuOidList( + IMA_OID oid, + IMA_OID_LIST **ppList +); + +IMA_API IMA_STATUS IMA_GetLuOid( + IMA_OID targetOid, + IMA_UINT64 lun, + IMA_OID *pluOid +); + +IMA_API IMA_STATUS IMA_GetLuProperties( + IMA_OID luOid, + IMA_LU_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_GetStatisticsProperties( + IMA_OID oid, + IMA_STATISTICS_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_GetDeviceStatistics( + IMA_OID oid, + IMA_DEVICE_STATISTICS *pStats +); + +IMA_API IMA_STATUS IMA_LuInquiry( + IMA_OID deviceOid, + IMA_BOOL evpd, + IMA_BOOL cmddt, + IMA_BYTE pageCode, + + IMA_BYTE *pOutputBuffer, + IMA_UINT *pOutputBufferLength, + + IMA_BYTE *pSenseBuffer, + IMA_UINT *pSenseBufferLength +); + +IMA_API IMA_STATUS IMA_LuReadCapacity( + IMA_OID deviceOid, + IMA_UINT cdbLength, + IMA_BYTE *pOutputBuffer, + IMA_UINT *pOutputBufferLength, + + IMA_BYTE *pSenseBuffer, + IMA_UINT *pSenseBufferLength +); + +IMA_API IMA_STATUS IMA_LuReportLuns( + IMA_OID deviceOid, + IMA_BOOL sendToWellKnownLun, + IMA_BYTE selectReport, + + IMA_BYTE *pOutputBuffer, + IMA_UINT *pOutputBufferLength, + + IMA_BYTE *pSenseBuffer, + IMA_UINT *pSenseBufferLength +); + +IMA_API IMA_STATUS IMA_ExposeLu( + IMA_OID luOid +); + +IMA_API IMA_STATUS IMA_UnexposeLu( + IMA_OID luOid +); + +IMA_API IMA_STATUS IMA_GetPhbaStatus( + IMA_OID hbaOid, + IMA_PHBA_STATUS *pStatus +); + +IMA_API IMA_STATUS IMA_RegisterForObjectVisibilityChanges ( + IMA_OBJECT_VISIBILITY_FN pClientFn +); + +IMA_API IMA_STATUS IMA_DeregisterForObjectVisibilityChanges ( + IMA_OBJECT_VISIBILITY_FN pClientFn +); + +IMA_API IMA_STATUS IMA_RegisterForObjectPropertyChanges ( + IMA_OBJECT_PROPERTY_FN pClientFn +); + +IMA_API IMA_STATUS IMA_DeregisterForObjectPropertyChanges ( + IMA_OBJECT_PROPERTY_FN pClientFn +); + + +IMA_API IMA_STATUS IMA_GetAddressKeyProperties( + IMA_OID targetOid, + IMA_ADDRESS_KEY_PROPERTIES **ppProps +); + +IMA_API IMA_STATUS IMA_GetIpProperties( + IMA_OID oid, + IMA_IP_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_SetIpConfigMethod( + IMA_OID oid, + IMA_BOOL enableDhcpIpConfiguration +); + +IMA_API IMA_STATUS IMA_SetIsnsDiscovery( + IMA_OID oid, + IMA_BOOL enableIsnsDiscovery, + IMA_ISNS_DISCOVERY_METHOD discoveryMethod, + const IMA_HOST_ID *iSnsHost +); + + +IMA_API IMA_STATUS IMA_SetSubnetMask( + IMA_OID oid, + IMA_IP_ADDRESS subnetMask +); + +IMA_API IMA_STATUS IMA_SetDnsServerAddress( + IMA_OID oid, + const IMA_IP_ADDRESS *pPrimaryDnsServerAddress, + const IMA_IP_ADDRESS *pAlternateDnsServerAddress +); + +IMA_API IMA_STATUS IMA_SetDefaultGateway( + IMA_OID oid, + IMA_IP_ADDRESS defaultGateway +); + +IMA_API IMA_STATUS IMA_GetSupportedAuthMethods( + IMA_OID lhbaOid, + IMA_BOOL getSettableMethods, + IMA_UINT *pMethodCount, + IMA_AUTHMETHOD *pMethodList +); + +IMA_API IMA_STATUS IMA_GetInUseInitiatorAuthMethods( + IMA_OID lhbaOid, + IMA_UINT *pMethodCount, + IMA_AUTHMETHOD *pMethodList +); + +IMA_API IMA_STATUS IMA_GetInitiatorAuthParms( + IMA_OID lhbaOid, + IMA_AUTHMETHOD method, + IMA_INITIATOR_AUTHPARMS *pParms +); + +IMA_API IMA_STATUS IMA_SetInitiatorAuthMethods( + IMA_OID lhbaOid, + IMA_UINT methodCount, + const IMA_AUTHMETHOD *pMethodList +); + +IMA_API IMA_STATUS IMA_SetInitiatorAuthParms( + IMA_OID lhbaOid, + IMA_AUTHMETHOD method, + const IMA_INITIATOR_AUTHPARMS *pParms +); + + +IMA_API IMA_STATUS IMA_GetStaticDiscoveryTargetOidList ( + IMA_OID oid, + IMA_OID_LIST **ppList +); + +IMA_API IMA_STATUS IMA_GetStaticDiscoveryTargetProperties( + IMA_OID staticDiscoveryTargetOid, + IMA_STATIC_DISCOVERY_TARGET_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_SetStaticDiscovery( + IMA_OID oid, + IMA_BOOL enableStaticDiscovery +); + +IMA_API IMA_STATUS IMA_GetDiscoveryProperties( + IMA_OID oid, + IMA_DISCOVERY_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_AddDiscoveryAddress( + IMA_OID oid, + const IMA_TARGET_ADDRESS discoveryAddress, + IMA_OID *pDiscoveryAddressOid +); + +IMA_API IMA_STATUS IMA_AddStaticDiscoveryTarget( + IMA_OID oid, + const IMA_STATIC_DISCOVERY_TARGET staticDiscoveryTarget, + IMA_OID *pStaticDiscoveryTargetOid +); + +IMA_API IMA_STATUS IMA_GetAddressKeys( + IMA_OID targetOid, + IMA_ADDRESS_KEYS **ppKeys +); + +IMA_API IMA_STATUS IMA_GetSessionOidList ( + IMA_OID oid, + IMA_OID_LIST **ppList +); + +IMA_API IMA_STATUS IMA_GetConnectionOidList ( + IMA_OID oid, + IMA_OID_LIST **ppList +); + +IMA_API IMA_STATUS IMA_GetDiscoveryAddressOidList ( + IMA_OID oid, + IMA_OID_LIST **ppList +); + +IMA_API IMA_STATUS IMA_GetDiscoveryAddressProperties ( + IMA_OID discoveryAddressOid, + IMA_DISCOVERY_ADDRESS_PROPERTIES *pProps +); + +IMA_API IMA_STATUS IMA_RemoveDiscoveryAddress ( + IMA_OID oid +); + +IMA_API IMA_STATUS QIMA_SetUpdateInterval(IMA_OID pluginOid, time_t interval); + +IMA_API IMA_STATUS IMA_CommitHbaParameters (IMA_OID lhba, IMA_COMMIT_LEVEL commitLevel); + +#endif + +#ifdef __cplusplus +}; +#endif + + diff --git a/usr/src/lib/libima/common/license.html b/usr/src/lib/libima/common/license.html new file mode 100644 index 0000000000..1b0c2e386d --- /dev/null +++ b/usr/src/lib/libima/common/license.html @@ -0,0 +1,397 @@ +<!-- + Copyright 2008 Sun Microsystems, Inc. All rights reserved. + Use is subject to license terms. + + CDDL HEADER START + + The contents of this file are subject to the terms of the + Common Development and Distribution License (the "License"). + You may not use this file except in compliance with the License. + + You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + or http://www.opensolaris.org/os/licensing. + See the License for the specific language governing permissions + and limitations under the License. + + When distributing Covered Code, include this CDDL HEADER in each + file and include the License file at usr/src/OPENSOLARIS.LICENSE. + If applicable, add the following below this CDDL HEADER, with the + fields enclosed by brackets "[]" replaced with your own identifying + information: Portions Copyright [yyyy] [name of copyright owner] + + CDDL HEADER END +--> + +<html><head> +<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> +<meta name="GENERATOR" content="Microsoft FrontPage 4.0"> +<meta name="ProgId" content="FrontPage.Editor.Document"><title>SNIA Public License v1.1</title> + +<meta name="Microsoft Theme" content="none"></head> + +<body> + +<p align="center"><b>STORAGE NETWORKING INDUSTRY ASSOCIATION<br> +PUBLIC LICENSE<br> +Version 1.1 </b><br> +________________________</p> +<p><b>1. Definitions.</b></p> +<ul> + <li>1.1 "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + </li><li>1.2 "Contributor" means each entity that creates or contributes + to the creation of Modifications. + </li><li>1.3 "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications made + by that particular Contributor. + </li><li>1.4 "Covered Code" means the Original Code or Modifications or + the combination of the Original Code and Modifications, in each case + including portions thereof. + </li><li>1.5 "Electronic Distribution Mechanism" means a mechanism + generally accepted in the software development community for the electronic + transfer of data. + </li><li>1.6 "Executable" means Covered Code in any form other than + Source Code. + </li><li>1.7 "Initial Developer" means the individual or entity + identified as the Initial Developer in the Source Code notice required by + Exhibit A. + </li><li>1.8 "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + </li><li>1.9 "License" means this document. + </li><li>1.10 "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + </li><li>1.11 "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + <ul> + <li>A. Any addition to or deletion from the contents of a file containing + Original Code or previous Modifications.</li> + <li>B. Any new file that contains any part of the Original Code or + previous Modifications.</li> + </ul> + <p>1.12 "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this License is + not already Covered Code governed by this License. + + </p></li><li>1.13 "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, and + apparatus claims, in any patent Licensable by grantor. + </li><li>1.14 "Source Code" means the preferred form of the Covered Code + for making modifications to it, including all modules it contains, plus any + associated interface definition files, scripts used to control compilation + and installation of an Executable, or source code differential comparisons + against either the Original Code or another well known, available Covered + Code of the Contributor's choice. The Source Code can be in a compressed or + archival form, provided the appropriate decompression or de-archiving + software is widely available for no charge. + </li><li>1.15 "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. For + legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of this + definition, "control" means (a) the power, direct or indirect, to + cause the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity</li> +</ul> +<p><b>2. Source Code License.</b></p> +<ul> + <li>2.1 The Initial Developer Grant. The Initial Developer hereby grants You a + world-wide, royalty-free, non-exclusive license, subject to third party + intellectual property claims: + <ul> + <li>(a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, modify, + display, perform, sublicense and distribute the Original Code (or + portions thereof) with or without Modifications, and/or as part of a + Larger Work; and + </li><li>(b) under Patents Claims infringed by the making, using or selling of + Original Code, to make, have made, use, practice, sell, and offer for + sale, and/or otherwise dispose of the Original Code (or portions + thereof). + </li><li>(c) the licenses granted in this Section 2.1(a) and (b) are effective + on the date Initial Developer first distributes Original Code under the + terms of this License. + </li><li>(d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) separate + from the Original Code; or 3) for infringements caused by: i) the + modification of the Original Code or ii) the combination of the Original + Code with other software or devices.</li> + </ul> + </li> +</ul> +<ul> + <li>2.2 Contributor Grant. Subject to third party intellectual property + claims, each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license + <ul> + <li>(a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications created by + such Contributor (or portions thereof) either on an unmodified basis, + with other Modifications, as Covered Code and/or as part of a Larger + Work; and + </li><li>(b) under Patent Claims infringed by the making, using, or selling of + Modifications made by that Contributor either alone and/or in + combination with its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, have made, and/or + otherwise dispose of: 1) Modifications made by that Contributor (or + portions thereof); and 2) the combination of Modifications made by that + Contributor with its Contributor Version (or portions of such + combination). + </li><li>(c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective + on the date Contributor first makes Commercial Use of the Covered Code. + </li><li>(d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; 3) for + infringements caused by: i) third party modifications of Contributor + Version or ii) the combination of Modifications made by that Contributor + with other software (except as part of the Contributor Version) or other + devices; or 4) under Patent Claims infringed by Covered Code in the + absence of Modifications made by that Contributor.</li> + </ul> + </li> +</ul> +<p><b>3. Distribution Obligations.</b></p> +<ul> + <li>3.1 Application of License. The Modifications which You create or to which + You contribute are governed by the terms of this License, including without + limitation Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version of this + License released under Section 6.1, and You must include a copy of this + License with every copy of the Source Code You distribute. You may not offer + or impose any terms on any Source Code version that alters or restricts the + applicable version of this License or the recipients' rights hereunder. + However, You may include an additional document offering the additional + rights described in Section 3.5. + </li><li>3.2 Availability of Source Code. Any Modification which You create or to + which You contribute must be made available in Source Code form under the + terms of this License either on the same media as an Executable version or + via an accepted Electronic Distribution Mechanism to anyone to whom you made + an Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six (6) + months after a subsequent version of that particular Modification has been + made available to such recipients. You are responsible for ensuring that the + Source Code version remains available even if the Electronic Distribution + Mechanism is maintained by a third party. + </li><li>3.3 Description of Modifications. You must cause all Covered Code to which + You contribute to contain a file documenting the changes You made to create + that Covered Code and the date of any change. You must include a prominent + statement that the Modification is derived, directly or indirectly, from + Original Code provided by the Initial Developer and including the name of + the Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the origin + or ownership of the Covered Code. + </li><li>3.4 Intellectual Property Matters. + <ul> + <li>(a) Third Party Claims. If Contributor has actual knowledge that a + license under a third party's intellectual property rights is required + to exercise the rights granted by such Contributor under Sections 2.1 or + 2.2, Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will know + whom to contact. If Contributor obtains such knowledge after the + Modification is made available as described in Section 3.2, Contributor + shall promptly modify the LEGAL file in all copies Contributor makes + available thereafter. + </li><li>(b) Contributor API's. If Contributor's Modifications include an + application programming interface and Contributor has actual knowledge + of patent licenses which are reasonably necessary to implement that API, + Contributor must also include this information in the LEGAL file. + </li><li>(c) Representations. Contributor represents that, except as disclosed + pursuant to Section 3.4(a) above, Contributor believes that + Contributor's Modifications are Contributor's original creation(s) + and/or Contributor has sufficient rights to grant the rights conveyed by + this License.</li> + </ul> + </li><li>3.5 Required Notices. You must duplicate the notice in <b>Exhibit A</b> in + each file of the Source Code. If it is not possible to put such notice in a + particular Source Code file due to its structure, then You must include such + notice in a location (such as a relevant directory) where a user would be + most likely to look for such a notice. If You created one or more + Modification(s) You may add your name as a Contributor to the notice + described in <b>Exhibit A. </b>You must also duplicate this License in any + documentation for the Source Code where You describe recipients' rights or + ownership rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability obligations to + one or more recipients of Covered Code. However, You may do so only on Your + own behalf, and not on behalf of the Initial Developer or any Contributor. + You must make it absolutely clear that any such warranty, support, indemnity + or liability obligation is offered by You alone, and You hereby agree to + indemnify the Initial Developer and every Contributor for any liability + (excluding any liability arising from intellectual property claims relating + to the Covered Code) incurred by the Initial Developer or such Contributor + as a result of warranty, support, indemnity or liability terms You offer. + </li><li>3.6 Distribution of Executable Versions. You may distribute Covered Code + in Executable form only if the requirements of Section<b> 3.1-3.5 </b>have + been met for that Covered Code, and if You include a notice stating that the + Source Code version of the Covered Code is available under the terms of this + License, including a description of how and where You have fulfilled the + obligation of Section <b>3.2.</b> The notice must be conspicuously included + in any notice in an Executable version, related documentation or collateral + in which You describe recipients' rights relating to the Covered Code. You + may distribute the Executable version of Covered Code or ownership rights + under a license of Your choice, which may contain terms different from this + License, provided that You are in compliance with the terms of this License + and that the license for the Executable version does not attempt to limit or + alter the recipient's rights in the Source Code version from the rights set + forth in this License. If You distribute the Executable version under a + different license You must make it absolutely clear that any terms which + differ from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the Initial + Developer and every Contributor for any liability (excluding any liability + arising from intellectual property claims relating to the Covered Code) + incurred by the Initial Developer or such Contributor as a result of any + such terms You offer. + </li><li>3.7 Larger Works. You may create a Larger Work by combining Covered Code + with other code not governed by the terms of this License and distribute the + Larger Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code.</li> +</ul> +<p><b>4. Inability to Comply Due to Statute or Regulation.</b> If it is +impossible for You to comply with any of the terms of this License with respect +to some or all of the Covered Code due to statute, judicial order, or regulation +then You must: (a) comply with the terms of this License to the maximum extent +possible; and (b) describe the limitations and the code they affect. Such +description must be included in the LEGAL file described in Section 3.4 and must +be included with all distributions of the Source Code. Except to the extent +prohibited by statute or regulation, such description must be sufficiently +detailed for a recipient of ordinary skill to be able to understand it.</p> +<p><b>5. Application of this License.</b> This License applies to code to which +the Initial Developer has attached the notice in Exhibit A and to related +Covered Code.</p> +<p><b>6. Versions of the License.</b></p> +<ul> + <li>6.1 New Versions. The Storage Networking Industry Association (the + "SNIA") may publish revised and/or new versions of the License + from time to time. Each version will be given a distinguishing version + number. + </li><li>6.2 Effect of New Versions. Once Covered Code has been published under a + particular version of the License, You may always continue to use it under + the terms of that version. You may also choose to use such Covered Code + under the terms of any subsequent version of the License published by the + SNIA. No one other than the SNIA has the right to modify the terms + applicable to Covered Code created under this License. + </li><li>6.3 Derivative Works. If You create or use a modified version of this + License (which you may only do in order to apply it to code which is not + already Covered Code governed by this License), You must (a) rename Your + license so that the phrases "Storage Networking Industry + Association," "SNIA," or any confusingly similar phrase do + not appear in your license (except to note that your license differs from + this License) and (b) otherwise make it clear that Your version of the + license contains terms which differ from the SNIA Public License. (Filling + in the name of the Initial Developer, Original Code or Contributor in the + notice described in Exhibit A shall not of themselves be deemed to be + modifications of this License.)</li> +</ul> +<p><b>7. DISCLAIMER OF WARRANTY. COVERED CODE IS PROVIDED UNDER THIS LICENSE ON +AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR +IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE +OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE +ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. +SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL +DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, +REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART +OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER +THIS DISCLAIMER.</b></p> +<p><b>8. TERMINATION.</b></p> +<ul> + <li><b>8.1 </b>This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure such + breach within a reasonable time after becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall survive any + termination of this License. Provisions which, by their nature, must remain + in effect beyond the termination of this License shall survive. + </li><li><b>8.2</b> If You initiate litigation by asserting a patent infringement + claim (excluding declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against whom You file + such action is referred to as "Participant") alleging that: + <ul> + <li><b>(a)</b> such Participant's Contributor Version directly or + indirectly infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License shall, + upon 60 days notice from Participant terminate prospectively, unless if + within 60 days after receipt of notice You either: (i) agree in writing + to pay Participant a mutually agreeable reasonable royalty for Your past + and future use of Modifications made by such Participant, or (ii) + withdraw Your litigation claim with respect to the Contributor Version + against such Participant. If within 60 days of notice, a reasonable + royalty and payment arrangement are not mutually agreed upon in writing + by the parties or the litigation claim is not withdrawn, the rights + granted by Participant to You under Sections 2.1 and/or 2.2 + automatically terminate at the expiration of the 60 day notice period + specified above.</li> + </ul> + </li><li><b>8.3</b> If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or indirectly + infringes any patent where such claim is resolved (such as by license or + settlement) prior to the initiation of patent infringement litigation, then + the reasonable value of the licenses granted by such Participant under + Sections 2.1 or 2.2 shall be taken into account in determining the amount or + value of any payment or license. + <p> </p> + </li><li><b>8.4</b> In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) which + have been validly granted by You or any distributor hereunder prior to + termination shall survive termination.</li> +</ul> +<p><b>9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL +THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, +THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED +CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY +INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER +INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, +COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR +LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR +PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE +LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR +LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND +LIMITATION MAY NOT APPLY TO YOU.</b></p> +<p><b>10. U.S. GOVERNMENT END USERS.</b> The Covered Code is a "commercial +item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting +of "commercial computer software" and "commercial computer +software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. +1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through +227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with +only those rights set forth herein.</p> +<p><b>11. MISCELLANEOUS </b>This License represents the complete agreement +concerning subject matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent necessary to +make it enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding its +conflict-of-law provisions. The application of the United Nations Convention on +Contracts for the International Sale of Goods is expressly excluded. Any law or +regulation which provides that the language of a contract shall be construed +against the drafter shall not apply to this License.</p> +<p><b>12. RESPONSIBILITY FOR CLAIMS.</b> As between Initial Developer and the +Contributors, each party is responsible for claims and damages arising, directly +or indirectly, out of its utilization of rights under this License and You agree +to work with Initial Developer and Contributors to distribute such +responsibility on an equitable basis. Nothing herein is intended or shall be +deemed to constitute any admission of liability.</p> +<p><b>13. MULTIPLE-LICENSED CODE.</b> Initial Developer may designate portions +of the Covered Code as "Multiple-Licensed". +"Multiple-Licensed" means that the Initial Developer permits you to +utilize portions of the Covered Code under Your choice of this License or the +alternative licenses, if any, specified by the Initial Developer in the file +described in Exhibit A.</p> +<p><b>14. ACCEPTANCE.</b> This License is accepted by You if You retain, use, or +distribute the Covered Code for any purpose.</p> +<p><b>EXHIBIT A —The SNIA Public License.</b></p> +<p>The contents of this file are subject to the SNIA Public License Version 1.1 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at</p> +<p> <a href="http://mp-mgmt-api.sourceforge.net/SourceLicense-v1.1.html">http://mp-mgmt-api.sourceforge.net/SourceLicense-v1.1.html</a></p> +<p>Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +for the specific language governing rights and limitations under the License.</p> +<p>The Original Code is <u> .</u></p> +<p>The Initial Developer of the Original Code is <u> [COMPLETE THIS] </u>.</p> +<p>Contributor(s): ______________________________________.</p> + +</body></html> diff --git a/usr/src/lib/libima/common/llib-lima b/usr/src/lib/libima/common/llib-lima new file mode 100644 index 0000000000..964a002b76 --- /dev/null +++ b/usr/src/lib/libima/common/llib-lima @@ -0,0 +1,29 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* LINTLIBRARY */ +/* PROTOLIB1 */ + +#include <ima.h> diff --git a/usr/src/lib/libima/common/mapfile-vers b/usr/src/lib/libima/common/mapfile-vers new file mode 100644 index 0000000000..7417d6cb2e --- /dev/null +++ b/usr/src/lib/libima/common/mapfile-vers @@ -0,0 +1,129 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# + +SUNW_1.0 { + global: + IMA_GetErrorRecoveryLevelProperties; + IMA_GetNetworkPortalProperties; + IMA_GetNodeProperties; + IMA_SetMaxBurstLength; + IMA_SetIsnsDiscovery; + IMA_GetLnpProperties; + IMA_LuReportLuns; + IMA_GetLibraryProperties; + IMA_GetPhbaDownloadProperties; + IMA_GetMaxRecvDataSegmentLengthProperties; + IMA_GetStaticDiscoveryTargetOidList; + IMA_SetNodeName; + IMA_DeregisterForObjectVisibilityChanges; + IMA_SetInitiatorAuthMethods; + IMA_GetImmediateDataProperties; + IMA_GenerateNodeName; + IMA_SetMaxConnections; + IMA_SetSlpDiscovery; + IMA_GetPnpProperties; + IMA_GetPhbaStatus; + IMA_FreeMemory; + IMA_GetNonSharedNodeOidList; + IMA_GetDataSequenceInOrderProperties; + IMA_SetStatisticsCollection; + IMA_SetInitiatorAuthParms; + IMA_GetStaticDiscoveryTargetProperties; + IMA_PluginIOCtl; + IMA_SetNodeAlias; + IMA_SetDefaultTime2Wait; + IMA_SetStaticDiscovery; + IMA_GetPnpStatistics; + IMA_GetIpProperties; + IMA_SetMaxOutstandingR2T; + IMA_SetNetworkPortalIpAddress; + IMA_GetDefaultTime2RetainProperties; + IMA_DeregisterForObjectPropertyChanges; + IMA_GetNetworkPortalOidList; + IMA_GetLuOid; + IMA_GetNetworkPortStatus; + IMA_AddDiscoveryAddress; + IMA_GetLhbaOidList; + IMA_SetInitialR2T; + IMA_GetIpsecProperties; + IMA_GetTargetProperties; + IMA_SetIpConfigMethod; + IMA_GetDiscoveryProperties; + IMA_SetErrorRecoveryLevel; + IMA_GetDiscoveryAddressProperties; + IMA_LuInquiry; + IMA_RegisterForObjectPropertyChanges; + IMA_GetTargetErrorStatistics; + IMA_GetMaxBurstLengthProperties; + IMA_GetPluginOidList; + IMA_GetLhbaProperties; + IMA_SetImmediateData; + IMA_GetPnpOidList; + IMA_GetLuOidList; + IMA_SetSubnetMask; + IMA_GetInUseInitiatorAuthMethods; + IMA_SetSendTargetsDiscovery; + IMA_GetDefaultTime2WaitProperties; + IMA_ExposeLu; + IMA_GetDiscoveryAddressOidList; + IMA_GetInitialR2TProperties; + IMA_GetStatisticsProperties; + IMA_UnexposeLu; + IMA_GetPluginProperties; + IMA_GetPhbaOidList; + IMA_SetDataPduInOrder; + IMA_IsPhbaDownloadFile; + IMA_GetLuProperties; + IMA_SetDnsServerAddress; + IMA_SetMaxRecvDataSegmentLength; + IMA_AddStaticDiscoveryTarget; + IMA_RemoveDiscoveryAddress; + IMA_GetDataPduInOrderProperties; + IMA_GetMaxOutstandingR2TProperties; + IMA_GetSharedNodeOid; + IMA_GetPhbaProperties; + IMA_GetTargetOidList; + IMA_PhbaDownload; + IMA_GetDeviceStatistics; + IMA_SetDefaultGateway; + IMA_GetSupportedAuthMethods; + IMA_SetDefaultTime2Retain; + IMA_RegisterForObjectVisibilityChanges; + IMA_RemoveStaticDiscoveryTarget; + IMA_GetFirstBurstLengthProperties; + IMA_GetAssociatedPluginOid; + IMA_GetObjectType; + IMA_SetFirstBurstLength; + IMA_RemoveStaleData; + IMA_GetLnpOidList; + IMA_LuReadCapacity; + IMA_SetDataSequenceInOrder; + IMA_GetInitiatorAuthParms; + IMA_GetMaxConnectionsProperties; + IMA_GetAddressKeys; + local: + *; +}; diff --git a/usr/src/lib/libima/i386/Makefile b/usr/src/lib/libima/i386/Makefile new file mode 100644 index 0000000000..95a52ca13f --- /dev/null +++ b/usr/src/lib/libima/i386/Makefile @@ -0,0 +1,31 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# + +include ../Makefile.com + +all: $(LIBS) + +install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) diff --git a/usr/src/lib/libima/sparc/Makefile b/usr/src/lib/libima/sparc/Makefile new file mode 100644 index 0000000000..95a52ca13f --- /dev/null +++ b/usr/src/lib/libima/sparc/Makefile @@ -0,0 +1,31 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# + +include ../Makefile.com + +all: $(LIBS) + +install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) diff --git a/usr/src/lib/libima/sparcv9/Makefile b/usr/src/lib/libima/sparcv9/Makefile new file mode 100644 index 0000000000..02b2100c3d --- /dev/null +++ b/usr/src/lib/libima/sparcv9/Makefile @@ -0,0 +1,33 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# + +include ../Makefile.com +include ../../Makefile.lib.64 + +all: $(LIBS) + +install: all $(ROOTLIBS64) $(ROOTLINKS64) + |
