configure.ac                          |    1 +
 osaf/libs/common/Makefile.am          |    2 +-
 osaf/libs/common/ais/Makefile.am      |   27 ++++++
 osaf/libs/common/ais/aisa_api.c       |  140 ++++++++++++++++++++++++++++++++++
 osaf/libs/saf/libSaAmf/Makefile.am    |    1 +
 osaf/libs/saf/libSaAmf/libSaAmf.map   |    1 +
 osaf/libs/saf/libSaCkpt/Makefile.am   |    1 +
 osaf/libs/saf/libSaCkpt/libSaCkpt.map |    1 +
 osaf/libs/saf/libSaClm/Makefile.am    |    1 +
 osaf/libs/saf/libSaClm/libSaClm.map   |    1 +
 osaf/libs/saf/libSaEvt/Makefile.am    |    1 +
 osaf/libs/saf/libSaEvt/libSaEvt.map   |    1 +
 osaf/libs/saf/libSaImm/Makefile.am    |    2 +
 osaf/libs/saf/libSaImm/libSaImmOi.map |    1 +
 osaf/libs/saf/libSaImm/libSaImmOm.map |    1 +
 osaf/libs/saf/libSaLck/Makefile.am    |    1 +
 osaf/libs/saf/libSaLck/libSaLck.map   |    1 +
 osaf/libs/saf/libSaLog/Makefile.am    |    1 +
 osaf/libs/saf/libSaLog/libSaLog.map   |    1 +
 osaf/libs/saf/libSaMsg/Makefile.am    |    1 +
 osaf/libs/saf/libSaMsg/libSaMsg.map   |    1 +
 osaf/libs/saf/libSaNtf/Makefile.am    |    1 +
 osaf/libs/saf/libSaNtf/libSaNtf.map   |    1 +
 osaf/libs/saf/libSaPlm/Makefile.am    |    1 +
 osaf/libs/saf/libSaPlm/libSaPlm.map   |    1 +
 osaf/libs/saf/libSaSmf/Makefile.am    |    1 +
 osaf/libs/saf/libSaSmf/libSaSmf.map   |    1 +
 27 files changed, 193 insertions(+), 1 deletions(-)


The functions saAisNameLend() and saAisNameBorrow() are defined in
saAis_B_5_14.h, but there is no libSaAis library. Therefore, these two functions
are put in all SAF libraries as weak aliases, so that an application can resolve
the symbols no matter what SAF libraries it is linked against.

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -690,6 +690,7 @@ AC_CONFIG_FILES([
         osaf/libs/core/mds/Makefile
         osaf/libs/core/mds/include/Makefile
         osaf/libs/common/Makefile
+        osaf/libs/common/ais/Makefile
         osaf/libs/common/amf/Makefile
         osaf/libs/common/amf/include/Makefile
         osaf/libs/common/cpsv/Makefile
diff --git a/osaf/libs/common/Makefile.am b/osaf/libs/common/Makefile.am
--- a/osaf/libs/common/Makefile.am
+++ b/osaf/libs/common/Makefile.am
@@ -18,7 +18,7 @@ include $(top_srcdir)/Makefile.common
 
 MAINTAINERCLEANFILES = Makefile.in
 
-SUBDIRS = amf immsv logsv ntfsv clmsv
+SUBDIRS = ais amf immsv logsv ntfsv clmsv
 
 if ENABLE_AIS_PLM
 
diff --git a/osaf/libs/common/ais/Makefile.am b/osaf/libs/common/ais/Makefile.am
new file mode 100644
--- /dev/null
+++ b/osaf/libs/common/ais/Makefile.am
@@ -0,0 +1,27 @@
+#      -*- OpenSAF  -*-
+#
+# (C) Copyright 2014 The OpenSAF Foundation
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
+# under the GNU Lesser General Public License Version 2.1, February 1999.
+# The complete license can be accessed from the following location:
+# http://opensource.org/licenses/lgpl-license.php
+# See the Copying file included with the OpenSAF distribution for full
+# licensing terms.
+#
+# Author(s): Ericsson AB
+#
+
+include $(top_srcdir)/Makefile.common
+
+MAINTAINERCLEANFILES = Makefile.in
+
+noinst_LTLIBRARIES = libais_common.la
+
+libais_common_la_CPPFLAGS = \
+       $(AM_CPPFLAGS)
+
+libais_common_la_SOURCES = \
+       aisa_api.c
diff --git a/osaf/libs/common/ais/aisa_api.c b/osaf/libs/common/ais/aisa_api.c
new file mode 100644
--- /dev/null
+++ b/osaf/libs/common/ais/aisa_api.c
@@ -0,0 +1,140 @@
+/*     -*- OpenSAF  -*-
+ *
+ * (C) Copyright 2014 The OpenSAF Foundation
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
+ * under the GNU Lesser General Public License Version 2.1, February 1999.
+ * The complete license can be accessed from the following location:
+ * http://opensource.org/licenses/lgpl-license.php
+ * See the Copying file included with the OpenSAF distribution for full
+ * licensing terms.
+ *
+ * Author(s): Ericsson AB
+ *
+ */
+
+/*****************************************************************************
+  DESCRIPTION:
+
+  The SaNameT type is deprecated will be replaced with string parameters in new
+  SAF APIs. As an intermediate solution, the extended format of the SaNameT 
type
+  can be used to pass string parameters to and from old SAF APIs as well, by
+  tunneling them through the SaNameT type. To enable the extended SaNameT
+  format, the application source code has to be compiled with the
+  SA_EXTENDED_NAME_SOURCE preprocessor macro defined, and the environment
+  variable SA_ENABLE_EXTENDED_NAMES must be set to the value 1 before the first
+  call to any SAF API function.
+
+  When the extended SaNameT format is enabled, the SA_MAX_NAME_LENGTH constant
+  must not be used, and the application must treat the SaNameT type as opaque
+  and not access any of its members directly. Instead, the saAisNameLend() and
+  saAisNameBorrow() access functions shall be used. The
+  SA_MAX_UNEXTENDED_NAME_LENGTH constant can be used to refer to the maximum
+  string length that can be stored in the unextended SaNameT type.
+
+*****************************************************************************/
+
+#ifndef SA_EXTENDED_NAME_SOURCE
+#define SA_EXTENDED_NAME_SOURCE
+#endif
+#define _GNU_SOURCE
+#include "saAis.h"
+#include <stddef.h>
+#include <stdbool.h>
+#include "osaf_extended_name.h"
+#include "logtrace.h"
+
+static void ais_name_lend(SaConstStringT value, SaNameT* name);
+static SaConstStringT ais_name_borrow(const SaNameT* name);
+
+/****************************************************************************
+  Name         :  saAisNameLend
+
+  Description  :  Tunnel a NUL-terminated string through a SaNameT type. If
+                  length of the string is strictly less than
+                  SA_MAX_UNEXTENDED_NAME_LENGTH bytes, the contents of the
+                  string is copied into the SaNameT type and can be read in a
+                  backwards compatible way by legacy applications that do not
+                  support the extended SaNameT format. If length of the string
+                  is greater than or equal to SA_MAX_UNEXTENDED_NAME_LENGTH, no
+                  copying is performed. Instead, a reference to the original
+                  string is stored in the SaNameT type. In this case, it is
+                  therefore important that the original string is not modified
+                  or freed for as long as the SaNameT type may still used.
+
+  Arguments    :  value [in] - A pointer to a NUL-terminated string that will
+                               be tunneled through the SaNameT type.
+
+                  name [out] - A pointer to an SaNameT type to be used for
+                               tunneling.
+
+  Return Values :
+
+  Notes                :
+******************************************************************************/
+void saAisNameLend(SaConstStringT value, SaNameT* name)
+       __attribute__ ((weak, alias ("ais_name_lend")));
+
+/****************************************************************************
+  Name         :  saAisNameBorrow
+
+  Description :           Retrieve a tunneled string from an SaNameT type. 
Before
+                  calling this function, the SaNameT stucture must have been
+                  initialized either by a call to the saAisNameLend() function
+                  or by being used as an output parameter of any other SAF API
+                  function. If the length of the returned string is strictly
+                  less than SA_MAX_UNEXTENDED_NAME_LENGTH bytes, the returned
+                  pointer points to a copy of the string stored inside the
+                  SaNameT type. Otherwise, the returned pointer is equal to the
+                  original string pointer that was passed as a parameter to the
+                  saAisNameLend() function.
+
+  Arguments    :  name [in] -  A pointer to an SaNameT type that has been
+                               previously set using the saAisNameLend()
+                               function.
+
+  Return Values :  A pointer to a NUL-terminated string, or a NULL pointer in
+                  case of a failure.
+
+  Notes                :
+******************************************************************************/
+SaConstStringT saAisNameBorrow(const SaNameT* name)
+       __attribute__ ((weak, alias ("ais_name_borrow")));
+
+void ais_name_lend(SaConstStringT value, SaNameT* name)
+{
+       TRACE_ENTER();
+       osaf_extended_name_lend(value, name);
+       TRACE_LEAVE();
+}
+
+SaConstStringT ais_name_borrow(const SaNameT* name)
+{
+       TRACE_ENTER();
+       SaConstStringT value = osaf_extended_name_borrow(name);
+       size_t length = name->_opaque[0];
+       if (length != kExtendedNameMagic) {
+               /*
+                * Check that the string inside SaNameT is properly
+                * NUL-terminated. If not, we return a NULL pointer. We allow
+                * the terminating NUL character to be counted in the length
+                * field, as this is a common mistake and still makes the string
+                * NUL-terminated (although with a length that is different from
+                * what the length field says).
+                *
+                * The reason for performing this check is that a C string MUST
+                * be NUL terminated, but the legacy SaNameT type did not
+                * require the string stored in the value field to be NUL
+                * terminated. It will always be NUL terminated if the SaNameT
+                * was set using the saAisNameLend() function, but potentially
+                * we could be passed an SaNameT that was set using legacy code.
+                */
+               bool valid = length < SA_MAX_UNEXTENDED_NAME_LENGTH &&
+                       value[length] == '\0';
+               if (!valid) value = NULL;
+       }
+       TRACE_LEAVE();
+       return value;
+}
diff --git a/osaf/libs/saf/libSaAmf/Makefile.am 
b/osaf/libs/saf/libSaAmf/Makefile.am
--- a/osaf/libs/saf/libSaAmf/Makefile.am
+++ b/osaf/libs/saf/libSaAmf/Makefile.am
@@ -42,5 +42,6 @@ endif
 
 libSaAmf_la_LIBADD = \
        $(top_builddir)/osaf/libs/core/libopensaf_core.la \
+       $(top_builddir)/osaf/libs/common/ais/libais_common.la \
        $(top_builddir)/osaf/libs/agents/saf/amfa/libava.la \
        $(top_builddir)/osaf/libs/common/amf/libamf_common.la
diff --git a/osaf/libs/saf/libSaAmf/libSaAmf.map 
b/osaf/libs/saf/libSaAmf/libSaAmf.map
--- a/osaf/libs/saf/libSaAmf/libSaAmf.map
+++ b/osaf/libs/saf/libSaAmf/libSaAmf.map
@@ -2,6 +2,7 @@
 
 {
        global:
+               saAis*;
                saAmf*;
                ava_install_amf_down_cb;        # FIXME ava* should be 
local-only
 
diff --git a/osaf/libs/saf/libSaCkpt/Makefile.am 
b/osaf/libs/saf/libSaCkpt/Makefile.am
--- a/osaf/libs/saf/libSaCkpt/Makefile.am
+++ b/osaf/libs/saf/libSaCkpt/Makefile.am
@@ -43,5 +43,6 @@ endif
 
 libSaCkpt_la_LIBADD = \
        $(top_builddir)/osaf/libs/core/libopensaf_core.la \
+       $(top_builddir)/osaf/libs/common/ais/libais_common.la \
        $(top_builddir)/osaf/libs/agents/saf/cpa/libcpa.la \
        $(top_builddir)/osaf/libs/common/cpsv/libcpsv_common.la
diff --git a/osaf/libs/saf/libSaCkpt/libSaCkpt.map 
b/osaf/libs/saf/libSaCkpt/libSaCkpt.map
--- a/osaf/libs/saf/libSaCkpt/libSaCkpt.map
+++ b/osaf/libs/saf/libSaCkpt/libSaCkpt.map
@@ -2,6 +2,7 @@
 
 {
        global:
+               saAis*;
                saCkpt*;
                # FIXME: Once adopted by SAF as an official API, remove from 
global
                ncsCkptRegisterCkptArrivalCallback;
diff --git a/osaf/libs/saf/libSaClm/Makefile.am 
b/osaf/libs/saf/libSaClm/Makefile.am
--- a/osaf/libs/saf/libSaClm/Makefile.am
+++ b/osaf/libs/saf/libSaClm/Makefile.am
@@ -43,5 +43,6 @@ endif
 
 libSaClm_la_LIBADD = \
        $(top_builddir)/osaf/libs/core/libopensaf_core.la \
+       $(top_builddir)/osaf/libs/common/ais/libais_common.la \
        $(top_builddir)/osaf/libs/agents/saf/clma/libclma.la \
        $(top_builddir)/osaf/libs/common/clmsv/libclmsv_common.la
diff --git a/osaf/libs/saf/libSaClm/libSaClm.map 
b/osaf/libs/saf/libSaClm/libSaClm.map
--- a/osaf/libs/saf/libSaClm/libSaClm.map
+++ b/osaf/libs/saf/libSaClm/libSaClm.map
@@ -2,6 +2,7 @@
 
 {
        global:
+               saAis*;
                saClm*;
 
        local:
diff --git a/osaf/libs/saf/libSaEvt/Makefile.am 
b/osaf/libs/saf/libSaEvt/Makefile.am
--- a/osaf/libs/saf/libSaEvt/Makefile.am
+++ b/osaf/libs/saf/libSaEvt/Makefile.am
@@ -43,5 +43,6 @@ endif
 
 libSaEvt_la_LIBADD = \
        $(top_builddir)/osaf/libs/core/libopensaf_core.la \
+       $(top_builddir)/osaf/libs/common/ais/libais_common.la \
        $(top_builddir)/osaf/libs/agents/saf/eda/libeda.la \
        $(top_builddir)/osaf/libs/common/edsv/libedsv_common.la
diff --git a/osaf/libs/saf/libSaEvt/libSaEvt.map 
b/osaf/libs/saf/libSaEvt/libSaEvt.map
--- a/osaf/libs/saf/libSaEvt/libSaEvt.map
+++ b/osaf/libs/saf/libSaEvt/libSaEvt.map
@@ -2,6 +2,7 @@
 
 {
        global:
+               saAis*;
                saEvt*;
 
        local:
diff --git a/osaf/libs/saf/libSaImm/Makefile.am 
b/osaf/libs/saf/libSaImm/Makefile.am
--- a/osaf/libs/saf/libSaImm/Makefile.am
+++ b/osaf/libs/saf/libSaImm/Makefile.am
@@ -43,6 +43,7 @@ endif
 
 libSaImmOi_la_LIBADD = \
        $(top_builddir)/osaf/libs/core/libopensaf_core.la \
+       $(top_builddir)/osaf/libs/common/ais/libais_common.la \
        $(top_builddir)/osaf/libs/agents/saf/imma/libimmaOi.la \
        $(top_builddir)/osaf/libs/common/immsv/libimmsv_common.la
 
@@ -63,5 +64,6 @@ endif
 
 libSaImmOm_la_LIBADD = \
        $(top_builddir)/osaf/libs/core/libopensaf_core.la \
+       $(top_builddir)/osaf/libs/common/ais/libais_common.la \
        $(top_builddir)/osaf/libs/agents/saf/imma/libimmaOm.la \
        $(top_builddir)/osaf/libs/common/immsv/libimmsv_common.la
diff --git a/osaf/libs/saf/libSaImm/libSaImmOi.map 
b/osaf/libs/saf/libSaImm/libSaImmOi.map
--- a/osaf/libs/saf/libSaImm/libSaImmOi.map
+++ b/osaf/libs/saf/libSaImm/libSaImmOi.map
@@ -6,6 +6,7 @@
 
 OPENSAF_IMM_A.02.01 {
        global:
+               saAis*;
                saImmOi*;
 
        local:
diff --git a/osaf/libs/saf/libSaImm/libSaImmOm.map 
b/osaf/libs/saf/libSaImm/libSaImmOm.map
--- a/osaf/libs/saf/libSaImm/libSaImmOm.map
+++ b/osaf/libs/saf/libSaImm/libSaImmOm.map
@@ -6,6 +6,7 @@
 
 OPENSAF_IMM_A.02.01 {
        global:
+               saAis*;
                saImmOm*;
                immsv_finalize_sync;    # FIXME immsv* should be in 
libimmsv_common.so
                immsv_sync;
diff --git a/osaf/libs/saf/libSaLck/Makefile.am 
b/osaf/libs/saf/libSaLck/Makefile.am
--- a/osaf/libs/saf/libSaLck/Makefile.am
+++ b/osaf/libs/saf/libSaLck/Makefile.am
@@ -42,5 +42,6 @@ endif
 
 libSaLck_la_LIBADD = \
        $(top_builddir)/osaf/libs/core/libopensaf_core.la \
+       $(top_builddir)/osaf/libs/common/ais/libais_common.la \
        $(top_builddir)/osaf/libs/agents/saf/gla/libgla.la \
        $(top_builddir)/osaf/libs/common/glsv/libglsv_common.la
diff --git a/osaf/libs/saf/libSaLck/libSaLck.map 
b/osaf/libs/saf/libSaLck/libSaLck.map
--- a/osaf/libs/saf/libSaLck/libSaLck.map
+++ b/osaf/libs/saf/libSaLck/libSaLck.map
@@ -2,6 +2,7 @@
 
 {
        global:
+               saAis*;
                saLck*;
 
        local:
diff --git a/osaf/libs/saf/libSaLog/Makefile.am 
b/osaf/libs/saf/libSaLog/Makefile.am
--- a/osaf/libs/saf/libSaLog/Makefile.am
+++ b/osaf/libs/saf/libSaLog/Makefile.am
@@ -43,4 +43,5 @@ endif
 
 libSaLog_la_LIBADD = \
        $(top_builddir)/osaf/libs/core/libopensaf_core.la \
+       $(top_builddir)/osaf/libs/common/ais/libais_common.la \
        $(top_builddir)/osaf/libs/agents/saf/lga/liblga.la
diff --git a/osaf/libs/saf/libSaLog/libSaLog.map 
b/osaf/libs/saf/libSaLog/libSaLog.map
--- a/osaf/libs/saf/libSaLog/libSaLog.map
+++ b/osaf/libs/saf/libSaLog/libSaLog.map
@@ -2,6 +2,7 @@
 
 {
        global:
+               saAis*;
                saLog*;
 
        local:
diff --git a/osaf/libs/saf/libSaMsg/Makefile.am 
b/osaf/libs/saf/libSaMsg/Makefile.am
--- a/osaf/libs/saf/libSaMsg/Makefile.am
+++ b/osaf/libs/saf/libSaMsg/Makefile.am
@@ -42,5 +42,6 @@ endif
 
 libSaMsg_la_LIBADD = \
        $(top_builddir)/osaf/libs/core/libopensaf_core.la \
+       $(top_builddir)/osaf/libs/common/ais/libais_common.la \
        $(top_builddir)/osaf/libs/agents/saf/mqa/libmqa.la \
        $(top_builddir)/osaf/libs/common/mqsv/libmqsv_common.la
diff --git a/osaf/libs/saf/libSaMsg/libSaMsg.map 
b/osaf/libs/saf/libSaMsg/libSaMsg.map
--- a/osaf/libs/saf/libSaMsg/libSaMsg.map
+++ b/osaf/libs/saf/libSaMsg/libSaMsg.map
@@ -2,6 +2,7 @@
 
 {
        global:
+               saAis*;
                saMsg*;
 
        local:
diff --git a/osaf/libs/saf/libSaNtf/Makefile.am 
b/osaf/libs/saf/libSaNtf/Makefile.am
--- a/osaf/libs/saf/libSaNtf/Makefile.am
+++ b/osaf/libs/saf/libSaNtf/Makefile.am
@@ -42,5 +42,6 @@ endif
 
 libSaNtf_la_LIBADD = \
        $(top_builddir)/osaf/libs/core/libopensaf_core.la \
+       $(top_builddir)/osaf/libs/common/ais/libais_common.la \
        $(top_builddir)/osaf/libs/agents/saf/ntfa/libntfa.la \
        $(top_builddir)/osaf/libs/common/ntfsv/libntfsv_common.la
diff --git a/osaf/libs/saf/libSaNtf/libSaNtf.map 
b/osaf/libs/saf/libSaNtf/libSaNtf.map
--- a/osaf/libs/saf/libSaNtf/libSaNtf.map
+++ b/osaf/libs/saf/libSaNtf/libSaNtf.map
@@ -2,6 +2,7 @@
 
 {
        global:
+               saAis*;
                saNtf*;
 
        local:
diff --git a/osaf/libs/saf/libSaPlm/Makefile.am 
b/osaf/libs/saf/libSaPlm/Makefile.am
--- a/osaf/libs/saf/libSaPlm/Makefile.am
+++ b/osaf/libs/saf/libSaPlm/Makefile.am
@@ -43,5 +43,6 @@ endif
 
 libSaPlm_la_LIBADD = \
        $(top_builddir)/osaf/libs/core/libopensaf_core.la \
+       $(top_builddir)/osaf/libs/common/ais/libais_common.la \
        $(top_builddir)/osaf/libs/agents/saf/plma/libplma.la \
        $(top_builddir)/osaf/libs/common/plmsv/libplmsv_common.la
diff --git a/osaf/libs/saf/libSaPlm/libSaPlm.map 
b/osaf/libs/saf/libSaPlm/libSaPlm.map
--- a/osaf/libs/saf/libSaPlm/libSaPlm.map
+++ b/osaf/libs/saf/libSaPlm/libSaPlm.map
@@ -2,6 +2,7 @@
 
 {
        global:
+               saAis*;
                saPlm*;
 
        local:
diff --git a/osaf/libs/saf/libSaSmf/Makefile.am 
b/osaf/libs/saf/libSaSmf/Makefile.am
--- a/osaf/libs/saf/libSaSmf/Makefile.am
+++ b/osaf/libs/saf/libSaSmf/Makefile.am
@@ -42,5 +42,6 @@ endif
 
 libSaSmf_la_LIBADD = \
        $(top_builddir)/osaf/libs/core/libopensaf_core.la \
+       $(top_builddir)/osaf/libs/common/ais/libais_common.la \
        $(top_builddir)/osaf/libs/agents/saf/smfa/libsmfa.la \
        $(top_builddir)/osaf/libs/common/smfsv/libsmfsv_common.la
diff --git a/osaf/libs/saf/libSaSmf/libSaSmf.map 
b/osaf/libs/saf/libSaSmf/libSaSmf.map
--- a/osaf/libs/saf/libSaSmf/libSaSmf.map
+++ b/osaf/libs/saf/libSaSmf/libSaSmf.map
@@ -2,6 +2,7 @@
 
 {
        global:
+               saAis*;
                saSmf*;
 
        local:

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://www.hpccsystems.com
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to