Author: kkaempf
Date: Thu Jul 5 10:45:20 2007
New Revision: 39182
URL: http://svn.opensuse.org/viewcvs/yast?rev=39182&view=rev
Log:
Initial import of openwsman plugin to access YaST
Added:
trunk/openwsman-yast/
trunk/openwsman-yast/Makefile.am
trunk/openwsman-yast/README
trunk/openwsman-yast/bootstrap (with props)
trunk/openwsman-yast/configure.in
trunk/openwsman-yast/openwsman-yast.changes
trunk/openwsman-yast/openwsman-yast.spec.in
trunk/openwsman-yast/src/
trunk/openwsman-yast/src/Makefile.am
trunk/openwsman-yast/src/WFM.h
trunk/openwsman-yast/src/openwsman/
trunk/openwsman-yast/src/openwsman/Makefile.am
trunk/openwsman-yast/src/openwsman/wsman-declarations.h
trunk/openwsman-yast/src/openwsman/wsman-dispatcher.h
trunk/openwsman-yast/src/openwsman/wsman-soap-envelope.h
trunk/openwsman-yast/src/openwsman/wsman-soap.h
trunk/openwsman-yast/src/yast.c
trunk/openwsman-yast/src/yast.h
trunk/openwsman-yast/src/yast_stub_custom.c
trunk/openwsman-yast/src/yast_stub_identify.c
trunk/openwsman-yast/src/yast_yast.cc
Added: trunk/openwsman-yast/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/Makefile.am?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/Makefile.am (added)
+++ trunk/openwsman-yast/Makefile.am Thu Jul 5 10:45:20 2007
@@ -0,0 +1,11 @@
+SUBDIRS = src
+
+AUTOMAKE_OPTIONS = no-dist-gzip dist-bzip2
+
+package: dist
+ cp openwsman-yast.spec /usr/src/packages/SPECS
+ cp openwsman-yast*.tar.gz /usr/src/packages/SOURCES
+ rpmbuild -ba openwsman-yast.spec
+
+etags: TAGS
+ find . -name "*.[chCH]" -print | etags -
Added: trunk/openwsman-yast/README
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/README?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/README (added)
+++ trunk/openwsman-yast/README Thu Jul 5 10:45:20 2007
@@ -0,0 +1,41 @@
+This plugin enables access to YaST via an openwsman plugin.
+
+Its namespace is
+ http://schema.opensuse.org/YaST/wsman-schema/10-3
+
+The inital release only implements the 'Custom' endpoint,
+serving the 'invoke' ws-man command.
+
+A single resource class 'YCP' is implemented with
+one method
+ eval (ycp : string) -> string
+
+It evaluates a piece of ycp code in the client environment.
+
+
+The ycp code follows the same rules as other yast programs:
+ - must be enclosed in { }
+ - required modules must be 'import'ed
+ - the result of the eval method is the value returned by
+ the first 'return' statement encountered.
+
+Examples of valid ycp code:
+
+1. Simple computation
+
+ { integer i = 42; float j = 10.3; return i+j; }
+
+
+2. Read /proc/modules
+
+ { return SCR::Read( .proc.modules ); }
+
+
+3. Call a method from the 'String' module (returns "4.00 KB")
+
+ { import "String"; return String::FormatSizeWithPrecision( 4096, 2, false ); }
+
+
+4. Get partitioning information
+
+ { import "Storage"; return Storage::GetDiskPartition("/dev/sda1"); }
Added: trunk/openwsman-yast/bootstrap
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/bootstrap?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/bootstrap (added)
+++ trunk/openwsman-yast/bootstrap Thu Jul 5 10:45:20 2007
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+UNAME=`uname`
+
+if [ "$UNAME" = "Darwin" ]; then
+libtoolize --copy --force --automake
+aclocal-1.9
+autoheader-2.60
+automake-1.9 --add-missing --copy --foreign
+autoconf-2.60
+
+else
+libtoolize --copy --force --automake
+aclocal
+autoheader
+automake --add-missing --copy --foreign
+autoconf
+fi
Added: trunk/openwsman-yast/configure.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/configure.in?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/configure.in (added)
+++ trunk/openwsman-yast/configure.in Thu Jul 5 10:45:20 2007
@@ -0,0 +1,225 @@
+dnl *******************************************
+dnl *** Initialize automake and set version ***
+dnl *******************************************
+
+AC_PREREQ(2.53)
+AC_INIT(openwsman-yast, 1.1.0)
+AC_CONFIG_SRCDIR(src/yast.c)
+AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+
+AM_CONFIG_HEADER(wsman_yast_config.h)
+AM_MAINTAINER_MODE
+AC_PROG_MAKE_SET
+
+PKG_CHECK_MODULES(WSMAN, openwsman >= 1.0, [
+ WSMAN_VERSION=`$PKG_CONFIG --modversion openwsman`],[
+ AC_MSG_ERROR([need openwsman-devel version 1.0 or greater], [-1])])
+AC_SUBST(WSMAN_VERSION)
+
+dnl ***************************
+dnl *** Set debugging flags ***
+dnl ***************************
+
+debug_default=minimum
+
+
+# Declare --enable-* args and collect ac_help strings
+AC_ARG_ENABLE(debug,
+ [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,
+ enable_debug=$debug_default)
+
+# Set the debug flags
+if test "x$enable_debug" = "xyes"; then
+ test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
+ OWSMAN_DEBUG_FLAGS="-DOWSMAN_ENABLE_DEBUG"
+ CFLAGS="$CFLAGS -DDEBUG_VERBOSE"
+else
+ if test "x$enable_debug" = "xno"; then
+ OWSMAN_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
+ fi
+fi
+
+# Set the debug flags
+if test "x$enable_debug" = "xyes"; then
+ AC_DEFINE(WSMAN_DEBUG_VERBOSE, 1, [Defined if verbose debug logging is requested])
+fi
+AC_SUBST(OWSMAN_DEBUG_FLAGS)
+
+
+
+# check for ssize_t
+AC_CHECK_TYPE(ssize_t, int)
+
+
+dnl ***************************
+dnl *** Checks for programs ***
+dnl ***************************
+
+
+AC_CHECK_FUNCS(strtok_r \
+getpid \
+strsep \
+gettimeofday \
+unlink \
+syslog \
+sleep \
+fnmatch \
+timegm \
+daemon \
+va_copy
+)
+
+
+AC_PROG_CC
+AC_PROG_CXX
+AM_PROG_CC_STDC
+AC_PROG_INSTALL
+
+# Set STDC_HEADERS
+AC_HEADER_STDC
+
+# Initialize libtool
+AC_LIBTOOL_WIN32_DLL
+AM_PROG_LIBTOOL
+
+# This isn't a program, but it doesn't fit anywhere else...
+AC_FUNC_ALLOCA
+
+PKG_CHECK_MODULES(XML, libxml-2.0)
+ AC_SUBST(XML_CFLAGS)
+ AC_SUBST(XML_LIBS)
+
+dnl ***********************
+dnl *** Check for Win32 ***
+dnl ***********************
+
+AC_MSG_CHECKING([for Win32])
+case "$host" in
+ *-*-mingw*)
+ os_win32=yes
+ AC_CACHE_VAL(ac_cv_func_getaddrinfo, [ac_cv_func_getaddrinfo=yes])
+ AC_CACHE_VAL(ac_cv_func_getnameinfo, [ac_cv_func_getnameinfo=yes])
+ AC_CACHE_VAL(ac_cv_func_inet_pton, [ac_cv_func_inet_pton=yes])
+ AC_CACHE_VAL(ac_cv_func_inet_ntop, [ac_cv_func_inet_ntop=yes])
+ AC_CACHE_VAL(soup_cv_ipv6, [soup_cv_ipv6=yes])
+ ;;
+ *)
+ os_win32=no
+ ;;
+esac
+AC_MSG_RESULT([$os_win32])
+AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
+
+dnl *******************
+dnl *** Misc checks ***
+dnl *******************
+AC_CHECK_FUNCS(gmtime_r)
+dnl ----------------------------------------------------------------------
+AC_CHECK_HEADERS([inttypes.h stdlib.h])
+AC_CHECK_HEADERS([net/if.h net/if_dl.h])
+AC_CHECK_HEADERS([sys/ioctl.h sys/sockio.h])
+AC_CHECK_HEADERS([crypt.h sys/ioctl.h dirent.h])
+AC_CHECK_HEADERS([vararg.h stdarg.h pthread.h])
+AC_CHECK_HEADERS([unistd.h sys/types.h sys/sendfile.h sys/signal.h])
+AC_CHECK_HEADERS([ctype.h sys/resource.h sys/socket.h sys/select.h])
+AC_CHECK_HEADERS([netinet/in.h], [], [],
+[#if HAVE_SYS_TYPES_H
+# include
+#endif
+])
+
+AC_HEADER_TIME
+dnl Checks for types
+AC_CHECK_TYPES([sa_family_t, in_port_t, in_addr_t], , ,
+[
+#if HAVE_SYS_TYPES_H
+# include
+#endif
+#if HAVE_SYS_SOCKET_H
+# include
+#endif
+#if HAVE_NETINET_IN_H
+# include
+#endif
+#if HAVE_ARPA_NAMESER_H
+# include
+#endif
+])
+
+ AC_CHECK_SIZEOF(short)
+ AC_CHECK_SIZEOF(int)
+ AC_CHECK_SIZEOF(long)
+ AC_CHECK_SIZEOF(long long)
+ SIZEOF_SHORT=$ac_cv_sizeof_short
+ SIZEOF_INT=$ac_cv_sizeof_int
+ SIZEOF_LONG=$ac_cv_sizeof_long
+ SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
+ AC_SUBST(SIZEOF_SHORT)
+ AC_SUBST(SIZEOF_INT)
+ AC_SUBST(SIZEOF_LONG)
+ AC_SUBST(SIZEOF_LONG_LONG)
+ AC_CHECK_FUNCS(srandom)
+ AC_CHECK_MEMBER(struct sockaddr.sa_len,
+ AC_DEFINE_UNQUOTED(HAVE_SA_LEN,
+ 1,
+ [Define if struct sockaddr contains sa_len]),,
+ [#include
+ #include ])
+
+dnl *********************************
+dnl *** Networking library checks ***
+dnl *********************************
+
+AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
+AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
+AC_CHECK_FUNCS(inet_pton inet_ntop inet_aton getaddrinfo getnameinfo)
+AC_CACHE_CHECK(IPv6 support, soup_cv_ipv6, [
+ AC_EGREP_HEADER(sockaddr_in6, netinet/in.h, soup_cv_ipv6=yes, soup_cv_ipv6=no)
+])
+
+
+
+if test "$prefix" = "NONE"; then
+ prefix=$ac_default_prefix;
+fi
+
+dnl Subst WSMAN_PLUGIN_DIR.
+dnl should come in via pkgconfig from openwsman !
+wsmanplugindir=$libdir/openwsman/plugins
+WSMAN_PLUGIN_DIR="${wsmanplugindir}"
+AC_SUBST(WSMAN_PLUGIN_DIR)
+
+
+dnl *************************************
+dnl *** Warnings to show if using GCC ***
+dnl *************************************
+
+AC_ARG_ENABLE(more-warnings,
+ [ --disable-more-warnings Inhibit compiler warnings],
+ set_more_warnings=no)
+
+if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
+ CFLAGS="$CFLAGS \
+ -Wall -Wstrict-prototypes -Wmissing-declarations \
+ -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
+ -Wunused -Werror"
+fi
+
+if test "$os_win32" != yes; then
+ # Use reentrant functions (FIXME!)
+ CFLAGS="$CFLAGS -D_REENTRANT"
+fi
+
+dnl *************************
+dnl *** Output Everything ***
+dnl *************************
+AC_SUBST(SYSCONFDIR)
+
+AC_CONFIG_FILES([
+ openwsman-yast.spec])
+
+AC_OUTPUT([
+ Makefile
+ src/Makefile
+ src/openwsman/Makefile
+ ])
Added: trunk/openwsman-yast/openwsman-yast.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/openwsman-yast.changes?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/openwsman-yast.changes (added)
+++ trunk/openwsman-yast/openwsman-yast.changes Thu Jul 5 10:45:20 2007
@@ -0,0 +1,23 @@
+-------------------------------------------------------------------
+Fri Jun 29 15:34:40 CEST 2007 - kkaempf@suse.de
+
+- xml-ify return message. Don't return YCPValue as string.
+ requires updated rwsman bindings (Xmlnode.attr())
+
+-------------------------------------------------------------------
+Wed Jun 27 22:06:50 CEST 2007 - kkaempf@suse.de
+
+- add post-install script to add plugin namespace to openwsman.conf
+ add pre-uninstall to take it out again
+
+-------------------------------------------------------------------
+Wed Jun 27 21:31:28 CEST 2007 - kkaempf@suse.de
+
+- Use pkg-config to check and determine minimal openwsman version.
+- Set interface version to match openwsman we build against.
+
+-------------------------------------------------------------------
+Wed Jun 27 15:30:56 CEST 2007 - kkaempf@suse.de
+
+- Initial release for openSUSE build service
+
Added: trunk/openwsman-yast/openwsman-yast.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/openwsman-yast.spec.in?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/openwsman-yast.spec.in (added)
+++ trunk/openwsman-yast/openwsman-yast.spec.in Thu Jul 5 10:45:20 2007
@@ -0,0 +1,39 @@
+Name: openwsman-yast
+Version: @PACKAGE_VERSION@
+Release: 2
+License: BSD
+Url: http://build.opensuse.org/project/show?project=home%3Akwk
+Source: %{name}-%{version}.tar.bz2
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Group: Applications/Management
+BuildRequires: openwsman >= 1.1.0 openwsman-devel >= 1.1.0 gcc-c++ pkgconfig libxml2-devel yast2-core-devel libxcrypt-devel
+Requires: openwsman >= 1.1.0
+Requires: yast2-core
+Summary: YaST as a WebService
+
+
+%description
+YaST as a WebService
+
+
+%prep
+%setup
+
+%build
+%configure --prefix=/usr --libdir=%{_libdir} --sysconfdir=/etc --docdir=/usr/share/doc/packages/openwsman --disable-static
+make
+
+%install
+make DESTDIR=%{buildroot} install
+rm %{buildroot}%{_libdir}/openwsman/plugins/*.la
+
+%clean
+rm -rf "$RPM_BUILD_ROOT"
+
+%files
+%defattr(-,root,root)
+%dir %{_libdir}/openwsman
+%dir %{_libdir}/openwsman/plugins
+%{_libdir}/openwsman/plugins/*so*
+
+%changelog
Added: trunk/openwsman-yast/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/src/Makefile.am?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/src/Makefile.am (added)
+++ trunk/openwsman-yast/src/Makefile.am Thu Jul 5 10:45:20 2007
@@ -0,0 +1,48 @@
+SUBDIRS = openwsman
+
+plugindir = @WSMAN_PLUGIN_DIR@
+y2plugindir = $(libdir)/YaST2/plugin
+
+AM_CFLAGS = -DWSMAN_VERSION=\"@WSMAN_VERSION@\"
+
+YAST2CORE = \
+ $(y2plugindir)/libpy2wfm.la \
+ $(y2plugindir)/libpy2scr.la \
+ $(libdir)/libycp.la \
+ $(libdir)/liby2.la \
+ $(libdir)/libyui.la
+
+INCLUDES = \
+ -I$(top_srcdir)/src/openwsman \
+ -I/usr/include/openwsman \
+ -I/usr/include/YaST2
+
+noinst_HEADERS = WFM.h
+
+#
+# do not add any libraries needed by a plugin.
+# link the plugin against any special library.
+#
+
+libwsman_yast_plugin_la_SOURCES = \
+ yast.c \
+ yast_stub_identify.c \
+ yast_stub_custom.c \
+ yast_yast.cc \
+ yast.h
+
+LIBS = \
+ $(XML_LIBS)
+
+plugin_LTLIBRARIES= libwsman_yast_plugin.la
+
+libwsman_yast_plugin_la_LDFLAGS= -version-info 1:0 \
+ -Xlinker --whole-archive \
+ $(PERL_LDFLAGS) \
+ $(YAST2CORE) \
+ -Xlinker --no-whole-archive
+
+libwsman_yast_plugin_la_LIBADD = \
+ $(XML_LIBS) \
+ -lpthread \
+ -ly2util
Added: trunk/openwsman-yast/src/WFM.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/src/WFM.h?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/src/WFM.h (added)
+++ trunk/openwsman-yast/src/WFM.h Thu Jul 5 10:45:20 2007
@@ -0,0 +1,9 @@
+// copied from yast/core/wfm/src
+class WFM {
+
+public:
+ WFM ();
+
+ static bool registered;
+};
+
Added: trunk/openwsman-yast/src/openwsman/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/src/openwsman/Makefile.am?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/src/openwsman/Makefile.am (added)
+++ trunk/openwsman-yast/src/openwsman/Makefile.am Thu Jul 5 10:45:20 2007
@@ -0,0 +1,10 @@
+#wsman-soap.h: missing in 1.0.1, available in trunk
+#wsman-soap-envelope.h: missing in 1.0.1, available in trunk
+#wsman-declarations.h: see http://www.openwsman.org/ticket/99
+#wsman-dispatcher.h: see http://www.openwsman.org/ticket/98
+
+noinst_HEADERS = \
+ wsman-soap.h \
+ wsman-soap-envelope.h \
+ wsman-declarations.h \
+ wsman-dispatcher.h
Added: trunk/openwsman-yast/src/openwsman/wsman-declarations.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/src/openwsman/wsman-declarations.h?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/src/openwsman/wsman-declarations.h (added)
+++ trunk/openwsman-yast/src/openwsman/wsman-declarations.h Thu Jul 5 10:45:20 2007
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (C) 2004-2006 Intel Corp. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Intel Corp. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *******************************************************************************/
+
+/**
+ * @author Anas Nashif
+ * @author Eugene Yarmosh
+ * @author Sumeet Kukreja, Dell Inc.
+ */
+
+#ifndef WSMAN_DECLARATIONS_H_
+#define WSMAN_DECLARATIONS_H_
+
+#include "wsman-soap.h"
+
+ // Server Plugin Interface Declarations
+
+#define START_END_POINTS(t) WsDispatchEndPointInfo t##_EndPoints[] = {
+
+#define END_POINT_IDENTIFY(t, ns) \
+ { WS_DISP_TYPE_IDENTIFY, NULL, NULL, NULL, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Identify_EP, ns, NULL}
+
+#define END_POINT_TRANSFER_GET(t, ns) \
+ { WS_DISP_TYPE_GET, NULL, NULL, TRANSFER_ACTION_GET, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Get_EP, ns, NULL}
+
+#define END_POINT_TRANSFER_DELETE(t, ns) \
+ { WS_DISP_TYPE_DELETE, NULL, NULL, TRANSFER_ACTION_DELETE, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Delete_EP, ns, NULL}
+
+#define END_POINT_TRANSFER_CREATE(t, ns) \
+ { WS_DISP_TYPE_CREATE, NULL, NULL, TRANSFER_ACTION_CREATE, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Create_EP, ns, NULL}
+
+#define END_POINT_TRANSFER_DIRECT_GET(t, ns) \
+ { WS_DISP_TYPE_DIRECT_GET, NULL, NULL, TRANSFER_ACTION_GET, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Get_EP, ns, NULL}
+
+#define END_POINT_TRANSFER_DIRECT_PUT(t, ns) \
+ { WS_DISP_TYPE_DIRECT_PUT, NULL, NULL, TRANSFER_ACTION_PUT, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Put_EP, ns, NULL}
+
+#define END_POINT_TRANSFER_DIRECT_DELETE(t, ns) \
+ { WS_DISP_TYPE_DIRECT_DELETE, NULL, NULL, TRANSFER_ACTION_DELETE, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Delete_EP, ns, NULL}
+
+#define END_POINT_TRANSFER_DIRECT_CREATE(t, ns) \
+ { WS_DISP_TYPE_DIRECT_CREATE, NULL, NULL, TRANSFER_ACTION_CREATE, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Create_EP, ns, NULL}
+
+#define END_POINT_TRANSFER_GET_NAMESPACE(t, ns) \
+ { WS_DISP_TYPE_GET_NAMESPACE, NULL, NULL, TRANSFER_ACTION_GET, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Get_EP, ns, NULL}
+
+#define END_POINT_TRANSFER_PUT(t, ns) \
+ { WS_DISP_TYPE_PUT, NULL, NULL, TRANSFER_ACTION_PUT, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Put_EP, ns, NULL}
+
+#define END_POINT_ENUMERATE(t, ns) \
+ { WS_DISP_TYPE_ENUMERATE, NULL, NULL, ENUM_ACTION_ENUMERATE, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Enumerate_EP, ns, NULL}
+
+#define END_POINT_RELEASE(t, ns) \
+ { WS_DISP_TYPE_RELEASE, NULL, NULL, ENUM_ACTION_RELEASE, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Release_EP, ns, NULL}
+
+#define END_POINT_PULL(t, ns) \
+ { WS_DISP_TYPE_PULL, NULL, NULL, ENUM_ACTION_PULL, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Pull_EP, ns, NULL}
+
+#define END_POINT_DIRECT_PULL(t, ns) \
+ { WS_DISP_TYPE_DIRECT_PULL, NULL, NULL, ENUM_ACTION_PULL, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Pull_EP, ns, NULL}
+
+#define END_POINT_PRIVATE_EP(t, a, m, ns) \
+ { WS_DISP_TYPE_PRIVATE, NULL, NULL, a, NULL, \
+ t##_TypeInfo, (WsProcType)t##_##m##_EP, ns, NULL }
+
+#define END_POINT_CUSTOM_METHOD(t, ns) \
+ { WS_DISP_TYPE_PRIVATE, NULL, NULL, NULL, NULL, \
+ t##_TypeInfo, (WsProcType)t##_Custom_EP, ns, NULL }
+
+#define END_POINT_LAST { 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+
+#define FINISH_END_POINTS(t) END_POINT_LAST }
+
+
+
+ // Server Plugin NamesSpaces Array
+
+#define START_NAMESPACES(t) WsSupportedNamespaces t##_Namespaces[] = {
+#define ADD_NAMESPACE( ns , prefix ) \
+ {ns, prefix }
+#define NAMESPACE_LAST { NULL , NULL }
+#define FINISH_NAMESPACES(t) NAMESPACE_LAST }
+
+
+ // Server Plugin EndPoints Array
+#define DECLARE_EP_ARRAY(t)\
+extern WsDispatchEndPointInfo t##_EndPoints[]
+
+
+
+#endif
Added: trunk/openwsman-yast/src/openwsman/wsman-dispatcher.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/src/openwsman/wsman-dispatcher.h?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/src/openwsman/wsman-dispatcher.h (added)
+++ trunk/openwsman-yast/src/openwsman/wsman-dispatcher.h Thu Jul 5 10:45:20 2007
@@ -0,0 +1,105 @@
+/*******************************************************************************
+* Copyright (C) 2004-2006 Intel Corp. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* - Redistributions of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* - Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* - Neither the name of Intel Corp. nor the names of its
+* contributors may be used to endorse or promote products derived from this
+* software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*******************************************************************************/
+
+/**
+ * @author Anas Nashif
+ * @author Eugene Yarmosh
+ */
+
+
+#ifndef WSMAN_DISPATCHER_H_
+#define WSMAN_DISPATCHER_H_
+
+
+#include "wsman-soap.h"
+
+/**
+ * @addtogroup Dispatcher
+ *
+ * @{
+ */
+
+struct __dispatch_t {
+ lnode_t node;
+ int usageCount;
+ char *inboundAction;
+ char *outboundAction;
+ unsigned long flags;
+ SoapH fw;
+ SoapServiceCallback serviceCallback;
+ void *serviceData;
+ list_t *inboundFilterList;
+ list_t *outboundFilterList;
+};
+
+struct __op_t {
+ SoapDispatchH dispatch;
+ time_t expires;
+ unsigned long submittedTicks;
+ WsContextH cntx;
+ WsXmlDocH in_doc;
+ //not deleted on destroy
+ WsXmlDocH out_doc;
+ //not deleted on destroy
+ WsmanMessage *data;
+ list_t *processed_headers;
+};
+typedef struct __op_t op_t;
+
+
+void dispatch_inbound_call(SoapH soap, WsmanMessage * msg,
+ void *opaqueData);
+
+SoapDispatchH wsman_dispatcher(WsContextH cntx, void *data, WsXmlDocH doc);
+
+void destroy_op_entry(op_t * entry);
+
+op_t *create_op_entry(SoapH soap, SoapDispatchH dispatch,
+ WsmanMessage * data);
+
+int unlink_response_entry(SoapH soap, op_t * entry);
+
+void destroy_dispatch_entry(SoapDispatchH entry);
+
+WsEndPointRelease wsman_get_release_endpoint(WsContextH cntx,
+ WsXmlDocH doc);
+
+void wsman_dispatch_start(SoapDispatchH disp);
+
+SoapDispatchH wsman_dispatch_create(SoapH soap, char *inboundAction, char *outboundAction,
+ char *role, //reserved, must be NULL
+ SoapServiceCallback callbackProc,
+ void *callbackData,
+ unsigned long flags);
+
+SoapDispatchH wsman_dispatch_entry_new(void);
+
+/** @} */
+#endif /* WS_DISPATCHER_H_ */
Added: trunk/openwsman-yast/src/openwsman/wsman-soap-envelope.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/src/openwsman/wsman-soap-envelope.h?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/src/openwsman/wsman-soap-envelope.h (added)
+++ trunk/openwsman-yast/src/openwsman/wsman-soap-envelope.h Thu Jul 5 10:45:20 2007
@@ -0,0 +1,126 @@
+/*******************************************************************************
+* Copyright (C) 2004-2006 Intel Corp. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* - Redistributions of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* - Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* - Neither the name of Intel Corp. nor the names of its
+* contributors may be used to endorse or promote products derived from this
+* software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*******************************************************************************/
+
+/**
+ * @author Anas Nashif
+ */
+
+#ifndef WSMAN_SOAP_ENVELOPE_H_
+#define WSMAN_SOAP_ENVELOPE_H_
+
+#include "wsman-types.h"
+
+#define ENFORCE_MUST_UNDERSTAND "EnforceMustUnderstand"
+
+int wsman_is_valid_envelope(WsmanMessage * msg, WsXmlDocH doc);
+
+char *wsman_get_soap_header_value(SoapH soap, WsXmlDocH doc, char *nsUri,
+ char *name);
+
+WsXmlNodeH wsman_get_soap_header_element(SoapH soap,
+ WsXmlDocH doc, char *nsUri,
+ char *name);
+
+WsXmlDocH wsman_build_soap_fault(SoapH soap, char *soapNsUri,
+ char *faultNsUri, char *code,
+ char *subCode, char *reason,
+ char *detail);
+
+
+WsXmlDocH wsman_create_response_envelope(WsContextH cntx,
+ WsXmlDocH rqstDoc, char *action);
+
+WsXmlDocH wsman_build_inbound_envelope(SoapH soap, WsmanMessage * msg);
+
+WsXmlDocH wsman_create_fault(WsContextH cntx, WsXmlDocH rqstDoc,
+ char *code, char *subCodeNs, char *subCode,
+ char *lang, char *reason,
+ void (*addDetailProc) (WsXmlNodeH, void *),
+ void *addDetailProcData);
+
+WsXmlDocH wsman_create_fault_envelope(WsContextH cntx,
+ WsXmlDocH rqstDoc,
+ char *code,
+ char *subCodeNs,
+ char *subCode,
+ char *fault_action,
+ char *lang,
+ char *reason, char *faultDetail);
+
+char *wsman_get_class_name(WsContextH cntx);
+
+char *wsman_get_method_name(WsContextH cntx);
+
+hash_t *wsman_get_method_args(WsContextH cntx, char *resource_uri);
+
+int wsman_get_max_elements(WsContextH cntx, WsXmlDocH doc);
+
+void wsman_set_estimated_total(WsXmlDocH in_doc,
+ WsXmlDocH out_doc,
+ WsEnumerateInfo * enumInfo);
+
+char *wsman_get_selector(WsContextH cntx, WsXmlDocH doc, char *name,
+ int index);
+
+hash_t *wsman_get_selectors_from_epr(WsXmlNodeH epr_node);
+
+hash_t *wsman_get_selector_list(WsContextH cntx, WsXmlDocH doc);
+
+hash_t *wsman_get_selector_list_from_filter(WsContextH cntx,
+ WsXmlDocH doc);
+
+void wsman_add_selector(WsXmlNodeH baseNode, char *name, char *val);
+
+char *wsman_get_action(WsContextH cntx, WsXmlDocH doc);
+
+char *wsman_get_resource_uri(WsContextH cntx, WsXmlDocH doc);
+
+int wsman_is_fault_envelope(WsXmlDocH doc);
+
+void wsman_set_fault(WsmanMessage * msg,
+ WsmanFaultCodeType fault_code,
+ WsmanFaultDetailType fault_detail_code,
+ const char *details);
+
+int wsman_is_identify_request(WsXmlDocH doc);
+
+int wsman_is_valid_xml_envelope(WsXmlDocH doc);
+
+void wsman_add_namespace_as_selector(WsXmlDocH doc, char *_namespace);
+
+char *wsman_get_option_set(WsContextH cntx, WsXmlDocH doc, const char *op);
+
+int wsman_parse_enum_request(WsContextH cntx, WsEnumerateInfo * enumInfo);
+
+WsXmlDocH wsman_create_doc(WsContextH cntx, const char *rootname);
+
+void wsman_destroy_doc(WsXmlDocH doc);
+
+#endif
Added: trunk/openwsman-yast/src/openwsman/wsman-soap.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/src/openwsman/wsman-soap.h?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/src/openwsman/wsman-soap.h (added)
+++ trunk/openwsman-yast/src/openwsman/wsman-soap.h Thu Jul 5 10:45:20 2007
@@ -0,0 +1,422 @@
+/*******************************************************************************
+ * Copyright (C) 2004-2006 Intel Corp. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Intel Corp. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *******************************************************************************/
+
+/**
+ * @author Anas Nashif
+ * @author Eugene Yarmosh
+ * @author Sumeet Kukreja, Dell Inc.
+ */
+
+#ifndef WSMAN_SOAP_H_
+#define WSMAN_SOAP_H_
+
+#include "u/libu.h"
+#include "wsman-faults.h"
+#include "wsman-soap-message.h"
+#include "wsman-xml-api.h"
+
+#define SOAP_MAX_RESENT_COUNT 10
+
+
+
+#define WS_DISP_TYPE_MASK 0xffff
+
+#define WS_DISP_TYPE_RAW_DOC 0
+#define WS_DISP_TYPE_GET 1
+#define WS_DISP_TYPE_PUT 2
+#define WS_DISP_TYPE_CREATE 3
+#define WS_DISP_TYPE_DELETE 4
+
+#define WS_DISP_TYPE_ENUMERATE 5
+#define WS_DISP_TYPE_PULL 6
+#define WS_DISP_TYPE_RELEASE 7
+#define WS_DISP_TYPE_UPDATE 8
+#define WS_DISP_TYPE_GETSTATUS 9
+#define WS_DISP_TYPE_COUNT 11
+#define WS_DISP_TYPE_DIRECT_PULL 12
+#define WS_DISP_TYPE_DIRECT_GET 13
+#define WS_DISP_TYPE_GET_NAMESPACE 14
+#define WS_DISP_TYPE_CUSTOM_METHOD 15
+#define WS_DISP_TYPE_DIRECT_PUT 16
+#define WS_DISP_TYPE_IDENTIFY 17
+#define WS_DISP_TYPE_DIRECT_CREATE 18
+#define WS_DISP_TYPE_DIRECT_DELETE 19
+#define WS_DISP_TYPE_ENUM_REFINSTS 21
+#define WS_DISP_TYPE_PRIVATE 0xfffe
+
+
+
+struct __dispatch_t;
+typedef struct __dispatch_t *SoapDispatchH;
+
+typedef SoapDispatchH(*DispatcherCallback) (WsContextH, void *, WsXmlDocH);
+
+
+struct __SoapOp {
+ unsigned __undefined;
+};
+typedef struct __SoapOp *SoapOpH;
+
+struct __Soap {
+ /* do not move this field */
+ pthread_mutex_t lockData;
+ void *parserData;
+ unsigned long uniqueIdCounter;
+
+ list_t *inboundFilterList;
+ list_t *outboundFilterList;
+
+ list_t *dispatchList;
+ list_t *responseList;
+ list_t *processedMsgIdList;
+
+ WsContextH cntx;
+ //TBD claen up and initilaize it;
+
+ unsigned long lastResponseListScanTicks;
+
+ //TBD:? ? ? Make it thread and pass as parameters
+ int resendCount;
+ unsigned long resentTimeout[SOAP_MAX_RESENT_COUNT];
+
+ list_t *WsSerializerAllocList;
+
+ void *dispatcherData;
+ DispatcherCallback dispatcherProc;
+ void *listener;
+};
+typedef struct __Soap *SoapH;
+
+struct _WsXmlDoc {
+ void *parserDoc;
+ SoapH fw;
+ unsigned long prefixIndex; // to enumerate not well known namespaces
+};
+
+
+struct __DispatchResponse {
+ char *buf;
+ int httpCode;
+};
+typedef struct __DispatchResponse DispatchResponse;
+
+
+struct _WS_CONTEXT_ENTRY {
+ lnode_t *node;
+ unsigned long size;
+ unsigned long options;
+ char *name;
+};
+typedef struct _WS_CONTEXT_ENTRY WS_CONTEXT_ENTRY;
+
+struct _WS_CONTEXT {
+ SoapH soap;
+ unsigned long enumIdleTimeout;
+ WsXmlDocH indoc;
+ hash_t *enuninfos;
+ hash_t *entries;
+ /* to prevent user from destroying cntx he hasn't created */
+ int owner;
+ /* the fields below are for optimization */
+ WS_CONTEXT_ENTRY *last_entry;
+// int last_get_name_idx;
+};
+
+
+typedef void (*WsProcType) (void);
+struct __XmlSerializerInfo;
+struct __WsDispatchEndPointInfo {
+ /* put/get/create/delete rpc enumerate/release/pull/update/getstatus */
+ unsigned long flags;
+ char *rqstName;
+ char *respName;
+ char *inAction;
+ char *outAction;
+ struct __XmlSerializerInfo *serializationInfo;
+ WsProcType serviceEndPoint;
+ void *data;
+ struct __WsSelector *selectors;
+};
+typedef struct __WsDispatchEndPointInfo WsDispatchEndPointInfo;
+
+struct __WsSupportedNamespaces {
+ char *ns;
+ char *class_prefix;
+};
+typedef struct __WsSupportedNamespaces WsSupportedNamespaces;
+
+
+struct __WsDispatchInterfaceInfo {
+ unsigned long flags;
+ char *config_id;
+ char *version;
+ char *notes;
+ char *vendor;
+ char *displayName;
+ char *compliance;
+ char *actionUriBase;
+ char *wsmanResourceUri;
+ void *extraData;
+ list_t *namespaces;
+ WsDispatchEndPointInfo *endPoints;
+};
+typedef struct __WsDispatchInterfaceInfo WsDispatchInterfaceInfo;
+
+struct __DispatchToEpMap {
+ SoapDispatchH disp;
+ WsDispatchEndPointInfo *ep;
+
+};
+typedef struct __DispatchToEpMap DispatchToEpMap;
+
+struct __WsManDispatcherInfo {
+ int interfaceCount;
+ int mapCount;
+ void *interfaces;
+ DispatchToEpMap map[1];
+};
+typedef struct __WsManDispatcherInfo WsManDispatcherInfo;
+
+
+
+typedef struct __WsEnumerateInfo WsEnumerateInfo;
+
+typedef int (*WsEndPointEnumerate) (WsContextH, WsEnumerateInfo *, WsmanStatus *, void *);
+
+typedef int (*WsEndPointPull) (WsContextH, WsEnumerateInfo *, WsmanStatus *, void *);
+
+typedef int (*WsEndPointRelease) (WsContextH, WsEnumerateInfo *, WsmanStatus *, void *);
+
+typedef int (*WsEndPointPut) (WsContextH, void *, void **, WsmanStatus *, void *);
+
+typedef void *(*WsEndPointGet) (WsContextH, WsmanStatus *, void *);
+
+
+#define EUIDLEN 64
+
+#define WSMAN_ENUMINFO_INWORK_FLAG 0x000010
+#define WSMAN_ENUMINFO_POLY_NONE 0x000020
+#define WSMAN_ENUMINFO_POLY_INCLUDE 0x000040
+#define WSMAN_ENUMINFO_POLY_EXCLUDE 0x000080
+#define WSMAN_ENUMINFO_EST_COUNT 0x000100
+#define WSMAN_ENUMINFO_OPT 0x000200
+#define WSMAN_ENUMINFO_EPR 0x000400
+#define WSMAN_ENUMINFO_OBJEPR 0x000800
+#define WSMAN_ENUMINFO_EXT 0x001000
+/* The value 0x010000 is already assigned to flag WSMAN_ENUMINFO_INWORK_FLAG */
+#define WSMAN_ENUMINFO_ASSOC 0x020000
+#define WSMAN_ENUMINFO_REF 0x040000
+
+
+
+
+struct __filter_t {
+ void *epr;
+ char *assocClass;
+ char *resultClass;
+ char *role;
+ char *resultRole;
+ char *xpath;
+};
+
+typedef struct __filter_t filter_t;
+
+struct __WsEnumerateInfo {
+ unsigned long flags;
+ char enumId[EUIDLEN];
+ unsigned long timeStamp; // in msecs
+ unsigned long expires; // expiration time in msecs since the epoch
+ unsigned int totalItems;
+ unsigned int maxItems;
+ unsigned int index;
+ void *enumResults;
+ void *pullResultPtr;
+ void *appEnumContext;
+ WsmanAuth auth_data;
+ WsEndPointRelease releaseproc;
+ char * epr_to;
+ char * epr_uri;
+ void * aux;
+ void *epr;
+ filter_t *filter;
+};
+
+
+enum __WsmanFilterDialect {
+ WSMAN_FILTER_XPATH,
+ WSMAN_FILTER_SELECTOR
+};
+typedef enum __WsmanFilterDialect WsmanFilterDialect;
+
+
+enum __WsmanPolymorphismMode {
+ INCLUDE_SUBCLASS_PROP = 1,
+ EXCLUDE_SUBCLASS_PROP,
+ POLYMORPHISM_NONE
+};
+typedef enum __WsmanPolymorphismMode WsmanPolymorphismMode;
+
+
+
+typedef int (*SoapServiceCallback) (SoapOpH, void *, void *);
+struct __callback_t {
+ lnode_t node;
+ //dataBuf is passed to callback as data
+ SoapServiceCallback proc;
+};
+typedef struct __callback_t callback_t;
+
+callback_t *
+make_callback_entry(SoapServiceCallback proc,
+ void *data,
+ list_t * list_to_add);
+
+
+
+SoapH ws_soap_initialize(void);
+void ws_set_context_enumIdleTimeout(WsContextH cntx,
+ unsigned long timeout);
+void soap_destroy_fw(SoapH soap);
+SoapH ws_context_get_runtime(WsContextH hCntx);
+
+
+
+int
+wsman_register_interface(WsContextH cntx,
+ WsDispatchInterfaceInfo * wsInterface,
+ WsManDispatcherInfo * dispInfo);
+int
+wsman_register_endpoint(WsContextH cntx,
+ WsDispatchInterfaceInfo * wsInterface,
+ WsDispatchEndPointInfo * ep,
+ WsManDispatcherInfo * dispInfo);
+
+
+int ws_transfer_put_stub(SoapOpH op, void *appData, void *opaqueData);
+int ws_transfer_delete_stub(SoapOpH op, void *appData, void *opaqueData);
+int wsman_identify_stub(SoapOpH op, void *appData, void *opaqueData);
+int wsenum_enumerate_stub(SoapOpH op, void *appData, void *opaqueData);
+int ws_transfer_get_stub(SoapOpH op, void *appData, void *opaqueData);
+int wsenum_pull_stub(SoapOpH op, void *appData, void *opaqueData);
+int wsenum_pull_raw_stub(SoapOpH op, void *appData, void *opaqueData);
+int wsenum_release_stub(SoapOpH op, void *appData, void *opaqueData);
+
+
+SoapOpH
+soap_create_op(SoapH soap,
+ char *inboundAction,
+ char *outboundAction,
+ char *role,
+ SoapServiceCallback callbackProc,
+ void *callbackData,
+ unsigned long flags);
+void soap_destroy_op(SoapOpH op);
+WsXmlDocH soap_get_op_doc(SoapOpH op, int inbound);
+WsXmlDocH soap_detach_op_doc(SoapOpH op, int inbound);
+int soap_set_op_doc(SoapOpH op, WsXmlDocH doc, int inbound);
+char *soap_get_op_action(SoapOpH op, int inbound);
+void soap_set_op_action(SoapOpH op, char *action, int inbound);
+unsigned long soap_get_op_flags(SoapOpH op);
+SoapH soap_get_op_soap(SoapOpH op);
+char *soap_get_op_dest_url(SoapOpH op);
+
+
+
+WsContextH ws_create_context(SoapH soap);
+void ws_initialize_context(WsContextH hCntx, SoapH soap);
+WsContextH ws_create_runtime(list_t * interfaces);
+WsContextH ws_create_ep_context(SoapH soap, WsXmlDocH doc);
+WsContextH ws_get_soap_context(SoapH soap);
+int ws_destroy_context(WsContextH hCntx);
+
+WsXmlDocH ws_get_context_xml_doc_val(WsContextH cntx, char *name);
+void *get_context_val(WsContextH hCntx, char *name);
+void *ws_get_context_val(WsContextH cntx, char *name, int *size);
+unsigned long ws_get_context_ulong_val(WsContextH cntx, char *name);
+
+int ws_set_context_ulong_val(WsContextH cntx, char *name, unsigned long val);
+int ws_set_context_xml_doc_val(WsContextH cntx, char *name, WsXmlDocH val);
+int ws_remove_context_val(WsContextH hCntx, char *name);
+
+
+hnode_t *
+create_context_entry(hash_t * h,
+ char *name,
+ void *val);
+
+void destroy_context_entry(WS_CONTEXT_ENTRY * entry);
+
+void ws_serializer_free_all(WsContextH cntx);
+
+
+int wsman_fault_occured(WsmanMessage * msg);
+
+WsmanKnownStatusCode wsman_find_httpcode_for_value(WsXmlDocH doc);
+
+WsmanKnownStatusCode wsman_find_httpcode_for_fault_code(WsmanFaultCodeType faultCode);
+
+
+
+WsXmlDocH
+wsman_generate_fault(
+ WsContextH cntx,
+ WsXmlDocH inDoc,
+ WsmanFaultCodeType faultCode,
+ WsmanFaultDetailType faultDetail,
+ char *fault_msg);
+void
+wsman_generate_fault_buffer(
+ WsContextH cntx,
+ WsXmlDocH inDoc,
+ WsmanFaultCodeType faultCode,
+ WsmanFaultDetailType faultDetail,
+ char *fault_msg,
+ char **buf,
+ int *len);
+
+
+
+void wsman_status_init(WsmanStatus * s);
+int wsman_check_status(WsmanStatus * s);
+
+void wsman_timeouts_manager(WsContextH cntx, void *opaqueData);
+
+
+int outbound_addressing_filter(SoapOpH opHandle, void *data,
+ void *opaqueData);
+
+int outbound_control_header_filter(SoapOpH opHandle, void *data,
+ void *opaqueData);
+
+int soap_add_filter(SoapH soap, SoapServiceCallback callbackProc,
+ void *callbackData, int inbound);
+
+
+#endif /* SOAP_API_H_ */
Added: trunk/openwsman-yast/src/yast.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/src/yast.c?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/src/yast.c (added)
+++ trunk/openwsman-yast/src/yast.c Thu Jul 5 10:45:20 2007
@@ -0,0 +1,172 @@
+/*
+ * YaST server side endpoint plugin
+ *
+ * Copyright (c) 2007 Novell Inc. All rights reserved.
+ * Written by Klaus Kaempf
+ *
+ * Based on 'cim_data' plugin. See copyright below.
+ *
+ */
+
+/*******************************************************************************
+* Copyright (C) 2004-2006 Intel Corp. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* - Redistributions of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* - Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* - Neither the name of Intel Corp. nor the names of its
+* contributors may be used to endorse or promote products derived from this
+* software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*******************************************************************************/
+
+/**
+ * @author Anas Nashif
+ * @author Eugene Yarmosh
+ * @author Klaus Kaempf
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "wsman_yast_config.h"
+#endif
+
+#include "stdlib.h"
+#include "stdio.h"
+#include "string.h"
+
+#ifdef HAVE_CTYPE_H
+#include "ctype.h"
+#endif
+
+#include
+
+#include "yast.h"
+
+//
+// ************ Serialization type information for resource ************
+//
+// It creates an array of items with name YaST_TypeInfo
+// It can be used in calls to WsSerialize and WsDeserialize
+//
+SER_START_ITEMS( YaST )
+SER_END_ITEMS( YaST );
+
+
+// ************** Array of end points for resource ****************
+//
+// Must follow general convention xxx_EndPoints
+//
+
+START_END_POINTS( YaST )
+ END_POINT_IDENTIFY( YaST, XML_NS_WSMAN_YAST ), // Identify
+// END_POINT_TRANSFER_DIRECT_CREATE( YaST, XML_NS_WSMAN_YAST ), // Create
+// END_POINT_TRANSFER_DIRECT_GET( YaST, XML_NS_WSMAN_YAST ), // Get
+// END_POINT_TRANSFER_DIRECT_PUT( YaST, XML_NS_WSMAN_YAST ), // Put
+// END_POINT_TRANSFER_DIRECT_DELETE( YaST, XML_NS_WSMAN_YAST ), // Delete
+// END_POINT_ENUMERATE( YaST, XML_NS_WSMAN_YAST ), // Enumerate
+// END_POINT_DIRECT_PULL( YaST, XML_NS_WSMAN_YAST ), // Pull
+// END_POINT_RELEASE( YaST, XML_NS_WSMAN_YAST ), // Release
+ END_POINT_CUSTOM_METHOD( YaST, XML_NS_WSMAN_YAST ), // Custom
+FINISH_END_POINTS( YaST );
+
+
+// ************** Array of name spaces for resource ****************
+//
+
+START_NAMESPACES( YaST )
+ ADD_NAMESPACE( XML_NS_WSMAN_YAST, "YaST" ),
+FINISH_NAMESPACES( YaST );
+
+
+// register namespaces with server
+//
+
+static list_t *
+set_namespaces(void)
+{
+
+ int i;
+
+ list_t *l = list_create(LISTCOUNT_T_MAX);
+ for (i = 0; YaST_Namespaces[i].ns != NULL; i++)
+ {
+ lnode_t *node;
+ WsSupportedNamespaces *ns = (WsSupportedNamespaces *)u_malloc(sizeof(WsSupportedNamespaces));
+ ns->class_prefix = YaST_Namespaces[i].class_prefix;
+ ns->ns = (char*) YaST_Namespaces[i].ns;
+ debug( "YaST prefix:namespace [%s:%s]", ns->class_prefix, ns->ns );
+ node = lnode_create(ns);
+ list_append(l, node);
+ }
+
+
+ return l;
+}
+
+
+// register end points with server
+//
+
+void get_endpoints(void *self, void **data)
+{
+ WsDispatchInterfaceInfo *ifc = (WsDispatchInterfaceInfo *)data;
+ ifc->flags = 0;
+ ifc->actionUriBase = NULL;
+ ifc->version = WSMAN_VERSION;
+ ifc->vendor = "Novell, Inc.";
+ ifc->displayName = "YaST";
+ ifc->notes = "Return value from call";
+ ifc->compliance = XML_NS_WS_MAN;
+ ifc->wsmanResourceUri = NULL;
+ ifc->extraData = NULL;
+ ifc->namespaces = set_namespaces();
+ ifc->endPoints = YaST_EndPoints;
+}
+
+
+// initialize plugin
+//
+
+int init( void *self, void **data )
+{
+ yast_initialize();
+ return 1;
+}
+
+// cleanup plugin
+//
+
+void
+cleanup( void *self, void *data )
+{
+ yast_finish();
+ return;
+}
+
+
+// ??
+//
+
+void set_config( void *self, dictionary *config )
+{
+ return;
+}
+
Added: trunk/openwsman-yast/src/yast.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/src/yast.h?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/src/yast.h (added)
+++ trunk/openwsman-yast/src/yast.h Thu Jul 5 10:45:20 2007
@@ -0,0 +1,79 @@
+//
+// yast.h
+//
+// This file is intended to be eventually generated by a codegen tool
+//
+#ifndef __WSMAN_YAST_H__
+#define __WSMAN_YAST_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+//#include
+#include
+
+#include
+
+// The resource is modeled as an xml string
+// see below: SER_DECLARE_TYPE
+struct __wsm_yast
+{
+ char *xml;
+};
+typedef struct __wsm_yast YaST;
+
+// Service endpoint declaration
+int YaST_Identify_EP( WsContextH cntx );
+
+int YaST_Enumerate_EP( WsContextH cntx, WsEnumerateInfo* enumInfo,
+ WsmanStatus *status,
+ void *opaqueData );
+
+int YaST_Release_EP( WsContextH cntx, WsEnumerateInfo* enumInfo,
+ WsmanStatus *status,
+ void *opaqueData );
+
+int YaST_Pull_EP( WsContextH cntx, WsEnumerateInfo* enumInfo,
+ WsmanStatus *status,
+ void *opaqueData );
+
+int YaST_Get_EP( SoapOpH op, void* appData, void *opaqueData );
+
+int YaST_Custom_EP( SoapOpH op, void* appData, void *opaqueData );
+
+int YaST_Put_EP( SoapOpH op, void* appData, void *opaqueData );
+
+int YaST_Create_EP( SoapOpH op, void* appData, void *opaqueData );
+
+int YaST_Delete_EP( SoapOpH op, void* appData, void *opaqueData );
+
+
+
+// Two macro below will declare
+// Serialization type info declaration for the resource
+// extern struct __XmlSerializerInfo YaST_TypeInfo[];
+// End point array declaration for the resource
+// extern WsDispatchEndPointInfo YaST_EndPoints[];
+SER_DECLARE_TYPE(YaST);
+DECLARE_EP_ARRAY(YaST);
+
+void get_endpoints(void *self, void **data);
+int init (void *self, void **data );
+void cleanup( void *self, void *data );
+void set_config( void *self, dictionary *config );
+
+#define XML_NS_WSMAN_YAST "http://schema.opensuse.org/YaST/wsman-schema/10-3"
+
+
+// yast_yast.cc
+extern int evaluate_ycp( const char *ycp, WsXmlNodeH out_body );
+extern void yast_initialize( void );
+extern void yast_finish( void );
+
+#ifdef __cplusplus
+} // extern "C"
+#endif /* __cplusplus */
+
+
+#endif // __WSMAN_YAST_H__
Added: trunk/openwsman-yast/src/yast_stub_custom.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/src/yast_stub_custom.c?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/src/yast_stub_custom.c (added)
+++ trunk/openwsman-yast/src/yast_stub_custom.c Thu Jul 5 10:45:20 2007
@@ -0,0 +1,230 @@
+/*
+ * YaST server side endpoint plugin stub for 'Custom'
+ *
+ * Copyright (c) 2007 Novell Inc. All rights reserved.
+ * Written by Klaus Kaempf
+ *
+ * Based on 'cim_data_stubs.c' plugin. See copyright below.
+ *
+ */
+
+/*******************************************************************************
+* Copyright (C) 2004-2006 Intel Corp. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* - Redistributions of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* - Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* - Neither the name of Intel Corp. nor the names of its
+* contributors may be used to endorse or promote products derived from this
+* software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*******************************************************************************/
+
+/**
+ * @author Anas Nashif
+ * @author Klaus Kaempf
+ */
+#ifdef HAVE_CONFIG_H
+#include "wsman_yast_config.h"
+#endif
+
+#include "stdlib.h"
+#include "stdio.h"
+#include "string.h"
+#include "ctype.h"
+
+#include
+#include
+#include
+#include
+
+#include
+
+#include "yast.h"
+
+
+static void
+debug_hash( hash_t *hash, const char *header )
+{
+ if (header) debug( header );
+ debug( " -- @ %p", hash );
+
+ if (hash == NULL) return;
+
+ hscan_t ptr;
+ hash_scan_begin( &ptr, hash );
+
+ hnode_t *node;
+ while ((node = hash_scan_next( &ptr )) ) {
+ debug ( "YaST: hash [%s] = [%s]", hnode_getkey( node ), hnode_get( node ) );
+ }
+ return;
+}
+
+
+/*
+ * Custom end point
+ *
+ */
+
+int
+YaST_Custom_EP( SoapOpH op,
+ void* appData,
+ void *opaqueData )
+{
+ debug( "YaST_Custom_EP Called");
+ WsXmlDocH in_doc = NULL; // the incoming body
+ WsXmlDocH out_doc = NULL; // the outgoing body
+
+ WsmanStatus status;
+ wsman_status_init( &status );
+
+ // retrieve the incoming SOAP message, the body and the context
+ SoapH soap = soap_get_op_soap( op );
+ in_doc = soap_get_op_doc( op, 1 );
+
+ if (in_doc) {
+ char *buf = NULL; int size;
+
+ WsXmlNodeH node = ws_xml_get_doc_root( in_doc );
+
+ ws_xml_dump_memory_node_tree( node, &buf, &size );
+ }
+
+ WsContextH cntx = ws_create_ep_context( soap, in_doc );
+ if (!cntx) {
+ error( "Cannot create context" );
+ return 1;
+ }
+
+ // retrieve the custom action
+
+ op_t *_op = (op_t *)op;
+ WsmanMessage *msg = (WsmanMessage *)_op->data;
+
+ if (!msg) {
+ status.fault_code = WSMAN_INTERNAL_ERROR;
+ status.fault_detail_code = WSMAN_DETAIL_FORMAT_MISMATCH;
+ debug( "YaST: No message in SOAP ?!" );
+ goto cleanup;
+ }
+
+ debug( "YaST: method '%s'", msg->method );
+ debug( "YaST: request '%s'", (char *)u_buf_ptr( msg->request ) );
+
+ // retrieve action
+ char *action = wsman_get_action( cntx, in_doc );
+ debug( "YaST: action '%s'", action );
+
+ // retrieve selectors
+ hash_t *selectors = wsman_get_selector_list( cntx, NULL );
+ debug_hash( selectors, "YaST: selectors" );
+
+ // retrieve class name
+ const char *classname = wsman_get_class_name( cntx );
+ debug( "YaST: classname '%s'", classname );
+
+ if ( strcmp( classname, "YCP" ) ) { // class YCP ?
+ status.fault_code = WSA_DESTINATION_UNREACHABLE;
+ status.fault_detail_code = WSMAN_DETAIL_INVALID_RESOURCEURI;
+ debug( "YaST: unknown class '%s'", classname );
+ goto cleanup;
+ }
+
+ // retrieve resoure URI
+ char *resource_uri = wsman_get_resource_uri( cntx, NULL );
+ debug( "YaST: resource_uri %s", resource_uri );
+
+ // retrieve custom method name and arguments
+ const char *methodname = wsman_get_method_name( cntx );
+ debug( "YaST: method name '%s'", methodname );
+
+ hash_t *method_args = wsman_get_method_args( cntx, resource_uri );
+ debug_hash( method_args, "YaST: method args" );
+
+ if ( !method_args ) { // args given ?
+ status.fault_code = WSMAN_INVALID_PARAMETER;
+ status.fault_detail_code = WSMAN_DETAIL_MISSING_VALUES;
+ debug( "YaST: no method arguments given" );
+ goto cleanup;
+ }
+
+ // check for 'eval'
+ if ( strcmp( methodname, "eval" ) ) {
+ status.fault_code = WSA_ACTION_NOT_SUPPORTED;
+ status.fault_detail_code = OWSMAN_NO_DETAILS;
+ debug( "YaST: action '%s' not supported", methodname );
+ goto cleanup;
+ }
+
+ debug ("YaST: YCP/eval called" );
+ // property for 'eval' must be 'ycp'
+ hnode_t *ycpnode = hash_lookup( method_args, "ycp" );
+ debug ("YaST: 'ycp' node @ %p", ycpnode );
+ if (!ycpnode) {
+ status.fault_code = WSMAN_SCHEMA_VALIDATION_ERROR;
+ status.fault_detail_code = WSMAN_DETAIL_INVALID_VALUE;
+ debug( "YaST: no 'ycp' property found for 'eval'" );
+ goto cleanup;
+ }
+
+ // get value of "ycp"
+ char *ycp = hnode_get( ycpnode );
+
+ // create response
+ out_doc = wsman_create_response_envelope( cntx, in_doc , NULL );
+
+ WsXmlNodeH out_body = ws_xml_get_soap_body( out_doc );
+
+ debug( "YaST: calling evaluate_ycp(%s)", ycp );
+ int result = evaluate_ycp( ycp, out_body );
+ debug( "YaST: result from evaluate_ycp(): '%d'", result );
+
+ if (result != 0) {
+ status.fault_code = WSMAN_INVALID_PARAMETER;
+ status.fault_detail_code = WSMAN_DETAIL_INVALID_VALUE;
+ debug( "YaST: invalid ycp code passed" );
+ goto cleanup;
+ }
+
+cleanup:
+
+ if (status.fault_code != WSMAN_RC_OK) {
+ if (out_doc) {
+ ws_xml_destroy_doc( out_doc );
+ }
+ out_doc = wsman_generate_fault( cntx, in_doc, status.fault_code,
+ status.fault_detail_code, NULL );
+ }
+
+ // return value handling
+
+ if (out_doc) {
+ soap_set_op_doc( op, out_doc, 0 );
+ } else {
+ error("Invalid result doc");
+ }
+
+ ws_destroy_context( cntx );
+
+ return 0;
+}
+
Added: trunk/openwsman-yast/src/yast_stub_identify.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/src/yast_stub_identify.c?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/src/yast_stub_identify.c (added)
+++ trunk/openwsman-yast/src/yast_stub_identify.c Thu Jul 5 10:45:20 2007
@@ -0,0 +1,113 @@
+/*
+ * YaST server side endpoint plugin stub for 'Identify'
+ *
+ * Copyright (c) 2007 Novell Inc. All rights reserved.
+ * Written by Klaus Kaempf
+ *
+ * Based on 'cim_data_stubs.c' plugin. See copyright below.
+ *
+ */
+
+/*******************************************************************************
+* Copyright (C) 2004-2006 Intel Corp. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* - Redistributions of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* - Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* - Neither the name of Intel Corp. nor the names of its
+* contributors may be used to endorse or promote products derived from this
+* software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*******************************************************************************/
+
+/**
+ * @author Anas Nashif
+ * @author Klaus Kaempf
+ */
+#ifdef HAVE_CONFIG_H
+#include "wsman_yast_config.h"
+#endif
+
+#include "stdlib.h"
+#include "stdio.h"
+#include "string.h"
+#include "ctype.h"
+
+#include
+#include
+#include
+#include
+
+#include "yast.h"
+
+
+/*
+ * Identify end point
+ *
+ */
+
+int
+YaST_Identify_EP( WsContextH cntx )
+{
+ // The resource is defined by the WS-Man standard and modeled as a struct
+ struct __wsmid_identify
+ {
+ XML_TYPE_STR ProtocolVersion;
+ XML_TYPE_STR ProductVendor;
+ XML_TYPE_STR ProductVersion;
+ };
+ typedef struct __wsmid_identify Wsmid_Identify;
+
+ SER_START_ITEMS( Wsmid_Identify )
+ SER_NS_STR( XML_NS_WSMAN_ID, "ProtocolVersion", 1 ),
+ SER_NS_STR( XML_NS_WSMAN_ID, "ProductVendor", 1 ),
+ SER_NS_STR( XML_NS_WSMAN_ID, "ProductVersion", 1),
+ SER_END_ITEMS( Wsmid_Identify );
+
+ Wsmid_Identify yast_identify = { XML_NS_WSMAN_YAST, "OpenWsman YaST plugin", PACKAGE_VERSION };
+
+ debug( "YaST_Identify_EP Called");
+
+ // build response envelope
+
+ WsXmlDocH in_doc = ws_get_context_xml_doc_val( cntx, WSFW_INDOC );
+ WsXmlDocH doc = wsman_create_response_envelope( cntx, in_doc , NULL );
+ WsXmlNodeH node = ws_xml_add_child( ws_xml_get_soap_body( doc ), XML_NS_WSMAN_ID, WSMID_IDENTIFY_RESPONSE, NULL );
+
+ // build response body
+
+// wsmid:IdentifyResponse
+// wsmid:ProtocolVersionhttp://schema.opensuse.org/...
+// wsmid:ProductVendorOpenWsman YaST plugin
+// wsmid:ProductVersion1.1.0rc1
+//
+
+ int result = ws_serialize( cntx,
+ node, // WsXmlNodeH xmlNode,
+ &yast_identify, // XML_TYPE_PTR dataPtr,
+ Wsmid_Identify_TypeInfo,// XmlSerializerInfo * info,
+ "YaST", // const char *name,
+ NULL, // const char *ns
+ NULL, // XML_NODE_ATTR * attrs,
+ 0); // int output)
+
+ return result;
+}
Added: trunk/openwsman-yast/src/yast_yast.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/openwsman-yast/src/yast_yast.cc?rev=39182&view=auto
==============================================================================
--- trunk/openwsman-yast/src/yast_yast.cc (added)
+++ trunk/openwsman-yast/src/yast_yast.cc Thu Jul 5 10:45:20 2007
@@ -0,0 +1,206 @@
+/*
+ * YaST runtime environment stub code
+ *
+ * Copyright (c) 2007 Novell Inc. All rights reserved.
+ * Written by Klaus Kaempf
+ *
+ *
+ */
+
+#define y2log_component "openwsman"
+
+#include
+
+#ifdef LOG_DEBUG
+#undef LOG_DEBUG
+#endif
+#ifdef LOG_WARNING
+#undef LOG_WARNING
+#endif
+#ifdef error
+#undef error
+#endif
+#ifdef warning
+#undef warning
+#endif
+#ifdef debug
+#undef debug
+#endif
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+
+#include "WFM.h" // should be
+
+#include "yast.h"
+
+
+void
+yast_initialize()
+{
+ static int initialized = 0;
+ if (initialized) return;
+
+ y2milestone( "yast_initialize()" );
+ YCPPathSearch::initialize();
+
+
+// Y2Component *scr = Y2ComponentBroker::getNamespaceComponent( "SCR" );
+ Y2Component *scr_server = Y2ComponentBroker::createServer( "scr" );
+
+ if (scr_server) {
+ SCRAgent *agent = scr_server->getSCRAgent();
+ y2milestone( "scr agent at %p", agent );
+
+ static SCR scr;
+ }
+ y2milestone( "scr component at %p", scr_server );
+
+ Y2Component *wfm_server = Y2ComponentBroker::createServer( "wfm" );
+
+ if (wfm_server) {
+ SCRAgent *agent = wfm_server->getSCRAgent();
+ y2milestone( "wfm agent at %p", agent );
+
+ static WFM wfm;
+ }
+ y2milestone( "wfm component at %p", wfm_server );
+
+}
+
+void
+yast_finish()
+{
+ y2milestone( "yast_finish()" );
+ return;
+}
+
+
+//-------------------------------------------------------------------
+static int xmlify( YCPValue result, WsXmlNodeH node );
+
+// YCPList -> <list>...</list>
+static int
+list2xml ( YCPList l, WsXmlNodeH node )
+{
+ node = ws_xml_add_child( node, XML_NS_WSMAN_YAST, "list", NULL);
+
+ int i = 0;
+ while( i < l->size() ) {
+ xmlify( l->value( i++ ), node );
+ }
+ return 0;
+}
+
+
+// YCPMap -> <map><key>...</key><value>...</value>...</map>
+
+static int
+map2xml ( YCPMap m, WsXmlNodeH node )
+{
+ node = ws_xml_add_child( node, XML_NS_WSMAN_YAST, "map", NULL);
+ for (YCPMapIterator it = m->begin(); it != m->end(); it++) {
+ xmlify( it.key( ), ws_xml_add_child( node, XML_NS_WSMAN_YAST, "key", NULL) );
+ xmlify( it.value( ), ws_xml_add_child( node, XML_NS_WSMAN_YAST, "value", NULL) );
+ }
+ return 0;
+}
+
+
+// YCPTerm -> <term name="...">...</term>
+
+static int
+term2xml ( YCPTerm t, WsXmlNodeH node )
+{
+ node = ws_xml_add_child( node, XML_NS_WSMAN_YAST, "term", NULL);
+ ws_xml_add_node_attr( node, XML_NS_WSMAN_YAST, "name", t->name().c_str() );
+
+ YCPList l = t->args();
+ int i = 0;
+ while( i < l->size() ) {
+ xmlify( l->value( i++ ), node );
+ }
+ return 0;
+}
+
+
+static int
+xmlify( YCPValue result, WsXmlNodeH node )
+{
+ char *name = NULL; const char *value;
+
+ switch (result->valuetype()) {
+ case YT_RETURN:
+ case YT_BREAK:
+ case YT_VOID: name = "void"; value = NULL;
+ break;
+ case YT_BOOLEAN:name = "bool"; value = result->toString().c_str();
+ break;
+ case YT_INTEGER:name = "int"; value = result->toString().c_str();
+ break;
+ case YT_FLOAT: name = "float"; value = result->toString().c_str();
+ break;
+ case YT_STRING: name = "string"; value = result->asString()->value().c_str();
+ break;
+ case YT_PATH: name = "path"; value = result->toString().c_str();
+ break;
+ case YT_SYMBOL: name = "symbol"; value = result->asSymbol()->symbol().c_str();
+ break;
+ case YT_LIST: return list2xml( result->asList(), node );
+ break;
+ case YT_TERM: return term2xml( result->asTerm(), node );
+ break;
+ case YT_MAP: return map2xml( result->asMap(), node );
+ break;
+ default:
+ y2error( "openwsman-yast: unsupported for XML: %s: %s", result->valuetype_str(), result->toString().c_str() );
+ return 1;
+ break;
+ }
+
+ ws_xml_add_child( node, XML_NS_WSMAN_YAST, name, value );
+
+ return 0;
+}
+
+
+// parse and evaluate YCP code
+// return ycp result as string
+
+int
+evaluate_ycp( const char *ycp, WsXmlNodeH out_body )
+{
+ yast_initialize();
+
+ y2milestone( "evaluate_ycp(%s)\n", ycp );
+
+ Parser parser( ycp ); // set parser to option
+
+ YCodePtr pc = parser.parse ();
+
+ if (!pc ) {
+ y2error( "Client option %s is not a valid YCP value", ycp );
+ return 1;
+ }
+
+ y2milestone( "Parsed(%s)", pc->toString().c_str() );
+
+ YCPValue result = pc->evaluate();
+ if (result.isNull()) {
+ y2error( "Evaluation failure" );
+ return 1;
+ }
+
+ // add xml to response
+ WsXmlNodeH node = ws_xml_add_child( out_body, XML_NS_WSMAN_YAST, "result", NULL );
+
+ return xmlify( result, node );
+}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org