PEP#: 305
authormike <mike>
Mon, 5 Nov 2007 01:47:22 +0000 (01:47 +0000)
committermike <mike>
Mon, 5 Nov 2007 01:47:22 +0000 (01:47 +0000)
TITLE: VxWorks Port

DESCRIPTION: Ongoing VxWorks porting.

12 files changed:
mak/vxworks/common.mak
mak/vxworks/diab.mak
mak/vxworks/gnu.mak
src/Pegasus/Common/Logger.cpp
src/Pegasus/Common/Logger.h [new file with mode: 0644]
src/Pegasus/Server/EmbeddedServer.cpp
src/Pegasus/Server/EmbeddedServer.h
src/Server/cimserver.cpp
vxworks/cimserver/cimserver.cpp
vxworks/iq8134x/Makefile
vxworks/iq8134x/pegasus.c [moved from vxworks/iq8134x/usrAppInit.c with 79% similarity]
vxworks/iq8134x/pegasus.cdf [new file with mode: 0644]

index 2586aafd1e06a275498d5de51ddea1a4ca38a8d8..4a7b3f663ed4fce4002744377ef5bad83d7724e4 100644 (file)
@@ -85,8 +85,6 @@ MAJOR_VERSION_NUMBER = 1
 
 LIB_SUFFIX = .so
 
-AR = arpentium
-
 SYS_LIBS =
 
 ##==============================================================================
index 9efcd8fb248bf688d4b5cd5107121b7b484be2f7..b37eddffffa195025c53809c8624407c804abb9b 100644 (file)
@@ -110,3 +110,5 @@ LINK_FLAGS += -r4
 NM = ddump -Ng
 
 MUNCH = wtxtcl $(WIND_BASE)/host/resource/hutils/tcl/munch.tcl -c $(__TARGET__)
+
+AR = dar
index c39df42ef0277038c4965ea4f213a174e9c12521..d4ebae7ce6d38e5a864997b80c7cba00d18230b2 100644 (file)
@@ -96,3 +96,5 @@ LINK_FLAGS += $(WIND_BASE)/target/h/tool/gnu/ldscripts/link.OUT
 NM = nm$(__TARGET__)
 
 MUNCH = wtxtcl $(WIND_BASE)/host/resource/hutils/tcl/munch.tcl -c $(__TARGET__)
+
+AR = ar$(__TARGET__)
index fc0cfabf67d88253591c510a77c8f324f1dbf000..5debe9576a77b091fa1b78d70d9bb2007e2f2b34 100644 (file)
@@ -49,6 +49,10 @@ PEGASUS_USING_STD;
 
 PEGASUS_NAMESPACE_BEGIN
 
+// Log callback function and data.
+static Logger::LogCallback _callback;
+static void* _data;
+
 // Maximum logfile size is defined as 32 MB = 32 * 1024 * 1024
 # define PEGASUS_MAX_LOGFILE_SIZE 0X2000000
 
@@ -203,9 +207,74 @@ public:
         Uint32 logLevel,
         const String localizedMsg)
     {
-#if defined(PEGASUS_OS_VXWORKS)
-        printf("LOGGER[%s]\n", (const char*)localizedMsg.getCString());
-#endif
+        // Use logging callback if installed and bypass logging logic below.
+
+        if (_callback)
+        {
+            // Set type:
+
+            int type;
+
+            switch (logFileType)
+            {
+                case Logger::TRACE_LOG:
+                    type = 1;
+                    break;
+                case Logger::STANDARD_LOG:
+                    type = 2;
+                    break;
+                case Logger::AUDIT_LOG:
+                    type = 3;
+                    break;
+                case Logger::ERROR_LOG:
+                    type = 4;
+                    break;
+                case Logger::DEBUG_LOG:
+                    type = 5;
+                    break;
+                default:
+                    return;
+            }
+
+            // Set system:
+
+            CString system(systemId.getCString());
+
+            // Set level:
+
+            int level;
+
+            switch (logLevel)
+            {
+                case Logger::TRACE:
+                    level = 1;
+                    break;
+                case Logger::INFORMATION:
+                    level = 2;
+                    break;
+                case Logger::WARNING:
+                    level = 3;
+                    break;
+                case Logger::SEVERE:
+                    level = 4;
+                    break;
+                case Logger::FATAL:
+                    level = 5;
+                    break;
+                default:
+                    return;
+            }
+
+            // Set message:
+
+            CString message(localizedMsg.getCString());
+
+            // Invoke the callback.
+
+            (*_callback)(type, system, level, message, _data);
+
+            return;
+        }
 
 #if defined(PEGASUS_USE_SYSLOGS)
 
@@ -812,4 +881,11 @@ Boolean Logger::isValidlogLevel(const String logLevel)
     return validlogLevel;
 }
 
+
+void Logger::setLogCallback(Logger::LogCallback callback, void* data)
+{
+    _callback = callback;
+    _data = data;
+}
+
 PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/Common/Logger.h b/src/Pegasus/Common/Logger.h
new file mode 100644 (file)
index 0000000..03988d7
--- /dev/null
@@ -0,0 +1,457 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_Logger_h
+#define Pegasus_Logger_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Formatter.h>
+#include <Pegasus/Common/Linkage.h>
+#include <Pegasus/Common/System.h>
+#include <Pegasus/Common/MessageLoader.h>
+
+// The Logger::trace optimization introduces the PEG_LOGGER_TRACE macro which
+// propagates branch conditions wherever it is used.  The optimization is
+// disabled for C-Cover builds so the coverage of these branches is not
+// measured.
+#ifdef PEGASUS_CCOVER
+# define PEG_LOGGER_TRACE(ARGS_LIST) \
+    Logger::trace ARGS_LIST
+#else
+# define PEG_LOGGER_TRACE(ARGS_LIST) \
+    do \
+    { \
+        if (Logger::wouldLog(Logger::TRACE)) \
+        { \
+            Logger::trace ARGS_LIST ; \
+        } \
+    } \
+    while (0)
+#endif
+
+PEGASUS_NAMESPACE_BEGIN
+
+class LoggerRep;
+
+/** This class provides the interface for writing log records to the log.
+*/
+class PEGASUS_COMMON_LINKAGE Logger
+{
+public:
+
+    enum LogFileType
+    {
+        TRACE_LOG,
+        STANDARD_LOG,
+        AUDIT_LOG, // Use only if PEGASUS_DISABLE_AUDIT_LOGGER is not defined
+        ERROR_LOG,
+        DEBUG_LOG
+    };
+
+    enum { NUM_LOGS = 5 };
+
+    /** Log file Level - Defines the loglevel of the log entry irrespective of
+        which log file it goes into. This is actually a bit mask as defined in
+        logger.cpp. Thus, it serves both as a level of indication of the
+        seriousness and possibly as a mask to select what is logged.
+        ATTN: The selection test has not been done.
+    */
+    static const Uint32 TRACE;
+    static const Uint32 INFORMATION;
+    static const Uint32 WARNING;
+    static const Uint32 SEVERE;
+    static const Uint32 FATAL;
+
+    /** Puts a message to the defined log file
+        @param logFileType - Type of log file (Trace, etc.)
+        @param systemId  - ID of the system generating the log entry within
+        Pegasus. This is user defined but generally breaks down into major
+        Pegasus components.
+        @param level logLevel of the log entry. To be used both t0
+        mark the log entry and tested against a mask to determine if log
+        entry should be written.
+        @param formatString     Format definition string for the Log. See the
+        Formatter for details.
+        @param Arg0 - Arg 9 - Up to 9 arguments representing the variables
+        that go into the log entry.
+        <pre>
+        Logger::put(Logger::TRACE_LOG, System::CIMSERVER, Logger::WARNING,
+            "X=$0, Y=$1, Z=$2", 88,  "Hello World", 7.5);
+        </pre>
+    */
+    static void put(
+        LogFileType logFileType,
+        const String& systemId,
+        Uint32 logLevel,
+        const String& formatString,
+        const Formatter::Arg& arg0,
+        const Formatter::Arg& arg1,
+        const Formatter::Arg& arg2,
+        const Formatter::Arg& arg3,
+        const Formatter::Arg& arg4 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg5 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg6 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg7 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg8 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg9 = Formatter::DEFAULT_ARG);
+
+    /** Optimized zero-argument form of put().
+    */
+    static void put(
+        LogFileType logFileType,
+        const String& systemId,
+        Uint32 logLevel,
+        const String& formatString);
+
+    /** Optimized one-argument form of put().
+    */
+    static void put(
+        LogFileType logFileType,
+        const String& systemId,
+        Uint32 logLevel,
+        const String& formatString,
+        const Formatter::Arg& arg0);
+
+    /** Optimized two-argument form of put().
+    */
+    static void put(
+        LogFileType logFileType,
+        const String& systemId,
+        Uint32 logLevel,
+        const String& formatString,
+        const Formatter::Arg& arg0,
+        const Formatter::Arg& arg1);
+
+    /** Optimized three-argument form of put().
+    */
+    static void put(
+        LogFileType logFileType,
+        const String& systemId,
+        Uint32 logLevel,
+        const String& formatString,
+        const Formatter::Arg& arg0,
+        const Formatter::Arg& arg1,
+        const Formatter::Arg& arg2);
+
+    /** put_l - Puts a localized message to the defined log file
+        @param logFileType - Type of log file (Trace, etc.)
+        @param systemId  - ID of the system generating the log entry within
+        Pegasus. This is user defined but generally breaks down into major
+        Pegasus components.
+        @param level logLevel of the log entry. To be used both t0
+        mark the log entry and tested against a mask to determine if log
+        entry should be written.
+        @param messageId Message ID of the format string to load from
+        the resource bundle.
+        @param formatString     Default format definition string. See the
+        Formatter for details.  This will be used as the default format string
+        in case the resource bundle cannot be found.
+        @param Arg0 - Arg 9 - Up to 9 arguments representing the variables
+        that go into the log entry.
+        <pre>
+        Logger::put(Logger::TRACE_LOG, System::CIMSERVER, Logger::WARNING,
+            "X=$0, Y=$1, Z=$2", 88,  "Hello World", 7.5);
+        </pre>
+    */
+    static void put_l(
+        LogFileType logFileType,
+        const String& systemId,
+        Uint32 logLevel,
+        const String& messageId,
+        const String& formatString,
+        const Formatter::Arg& arg0,
+        const Formatter::Arg& arg1,
+        const Formatter::Arg& arg2,
+        const Formatter::Arg& arg3,
+        const Formatter::Arg& arg4 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg5 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg6 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg7 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg8 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg9 = Formatter::DEFAULT_ARG);
+
+    /** Optimized zero-argument form of put_l().
+    */
+    static void put_l(
+        LogFileType logFileType,
+        const String& systemId,
+        Uint32 logLevel,
+        const String& messageId,
+        const String& formatString);
+
+    /** Optimized one-argument form of put_l().
+    */
+    static void put_l(
+        LogFileType logFileType,
+        const String& systemId,
+        Uint32 logLevel,
+        const String& messageId,
+        const String& formatString,
+        const Formatter::Arg& arg0);
+
+    /** Optimized two-argument form of put_l().
+    */
+    static void put_l(
+        LogFileType logFileType,
+        const String& systemId,
+        Uint32 logLevel,
+        const String& messageId,
+        const String& formatString,
+        const Formatter::Arg& arg0,
+        const Formatter::Arg& arg1);
+
+    /** Optimized three-argument form of put_l().
+    */
+    static void put_l(
+        LogFileType logFileType,
+        const String& systemId,
+        Uint32 logLevel,
+        const String& messageId,
+        const String& formatString,
+        const Formatter::Arg& arg0,
+        const Formatter::Arg& arg1,
+        const Formatter::Arg& arg2);
+
+    /** Puts a message to the define log. Should only be used for trace type
+        logs.
+    */
+    static void trace(
+        LogFileType logFileType,
+        const String& systemId,
+        const Uint32 logComponent,
+        const String& formatString,
+        const Formatter::Arg& arg0,
+        const Formatter::Arg& arg1,
+        const Formatter::Arg& arg2,
+        const Formatter::Arg& arg3,
+        const Formatter::Arg& arg4 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg5 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg6 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg7 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg8 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg9 = Formatter::DEFAULT_ARG);
+
+    /** Optimized three-argument form of trace().
+    */
+    static void trace(
+        LogFileType logFileType,
+        const String& systemId,
+        const Uint32 logComponent,
+        const String& formatString);
+
+    /** Optimized one-argument form of trace().
+    */
+    static void trace(
+        LogFileType logFileType,
+        const String& systemId,
+        const Uint32 logComponent,
+        const String& formatString,
+        const Formatter::Arg& arg0);
+
+    /** Optimized two-argument form of trace().
+    */
+    static void trace(
+        LogFileType logFileType,
+        const String& systemId,
+        const Uint32 logComponent,
+        const String& formatString,
+        const Formatter::Arg& arg0,
+        const Formatter::Arg& arg1);
+
+    /** Optimized three-argument form of trace().
+    */
+    static void trace(
+        LogFileType logFileType,
+        const String& systemId,
+        const Uint32 logComponent,
+        const String& formatString,
+        const Formatter::Arg& arg0,
+        const Formatter::Arg& arg1,
+        const Formatter::Arg& arg2);
+
+    /** Puts a localized message to the log. Should only be used
+        for trace type logs.
+    */
+    static void trace_l(
+        LogFileType logFileType,
+        const String& systemId,
+        const Uint32 logComponent,
+        const String& messageId,
+        const String& formatString,
+        const Formatter::Arg& arg0,
+        const Formatter::Arg& arg1,
+        const Formatter::Arg& arg2,
+        const Formatter::Arg& arg3,
+        const Formatter::Arg& arg4 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg5 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg6 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg7 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg8 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg9 = Formatter::DEFAULT_ARG);
+
+    /** Optimized zero-argument form of trace_l().
+    */
+    static void trace_l(
+        LogFileType logFileType,
+        const String& systemId,
+        const Uint32 logComponent,
+        const String& messageId,
+        const String& formatString);
+
+    /** Optimized one-argument form of trace_l().
+    */
+    static void trace_l(
+        LogFileType logFileType,
+        const String& systemId,
+        const Uint32 logComponent,
+        const String& messageId,
+        const String& formatString,
+        const Formatter::Arg& arg0);
+
+    /** Optimized two-argument form of trace_l().
+    */
+    static void trace_l(
+        LogFileType logFileType,
+        const String& systemId,
+        const Uint32 logComponent,
+        const String& messageId,
+        const String& formatString,
+        const Formatter::Arg& arg0,
+        const Formatter::Arg& arg1);
+
+    /** Optimized three-argument form of trace_l().
+    */
+    static void trace_l(
+        LogFileType logFileType,
+        const String& systemId,
+        const Uint32 logComponent,
+        const String& messageId,
+        const String& formatString,
+        const Formatter::Arg& arg0,
+        const Formatter::Arg& arg1,
+        const Formatter::Arg& arg2);
+
+    /** setHomeDirectory
+    */
+    static void setHomeDirectory(const String& homeDirectory);
+
+    /** setlogLevelMask
+    */
+    static void setlogLevelMask(const String logLevelList);
+
+    /** setLogWriteControlMask
+    */
+    static void setLogWriteControlMask(const Uint32);
+
+    /** Returns true if the given string is one of the legal log levels.
+    */
+    static Boolean isValidlogLevel(const String logLevel);
+
+    /** Tests if a log entry would be created by this call before
+        the logger is called.  This function is intended to be used
+        within the server for high usage log entries to avoid the
+        overhead of doing the call when no log is created.
+        @param logLevel Uint32 defining the level of the log to be
+        executed.
+        <p><b>Example:</b>
+        <pre>
+        if (Logger::wouldLog(Logger::TRACE))
+        {
+            Logger::put(Logger::STANDARD_LOG, System::CIMSERVER,
+                Logger::TRACE, "HTTPMessage - HTTP header name: $0  "
+                "HTTP header value: $1" ,name,value);
+        }
+        </pre>
+    */
+    static Boolean wouldLog(Uint32 logLevel)
+    {
+        return (_severityMask & logLevel) != 0;
+    }
+
+    /** Log callback, passed to setLogCallback(). Note that no types defined
+        by this class are used as parameters of this callback. This makes it
+        possible to chain calls to a callback with an identical signature
+        without exposing the Logger class.
+
+        @param type log type (1=TRACE, 2=STANDARD, 3=AUDIT, 4=ERROR, 5=DEBUG).
+        @param system name of system performing log.
+        @param level log level (1=TRACE, 2=INFO, 3=WARNING, 4=SEVERE, 5=FATAL).
+        @param message the localized log message.
+        @param data data passed to the callback.
+    */
+    typedef void (*LogCallback)(
+        int type,
+        const char* system,
+        int level,
+        const char* message,
+        void* data);
+
+    /** Install a callback that is called whenever a log record is logged.
+    */
+    static void setLogCallback(Logger::LogCallback callback, void* data);
+
+private:
+
+    static LoggerRep* _rep;
+    static String _homeDirectory;
+    static Uint32 _severityMask;
+    static Uint32 _writeControlMask;
+
+    static const char   _SEPARATOR;
+    static const Uint32 _NUM_LOGLEVEL;
+
+    static const Boolean _SUCCESS;
+    static const Boolean _FAILURE;
+
+    static void _putInternal(
+        LogFileType logFileType,
+        const String& systemId,
+        const Uint32 logComponent,
+        Uint32 logLevel,
+        const String& formatString,
+        const String& messageId,
+        const Formatter::Arg& arg0 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg1 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg2 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg3 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg4 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg5 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg6 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg7 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg8 = Formatter::DEFAULT_ARG,
+        const Formatter::Arg& arg9 = Formatter::DEFAULT_ARG);
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_Logger_h */
index 26d1d3a0c649c42af67d36e2144e5fb7f4d97cd3..f339d04bff35e1fe7b32e44597dd395c50d3bfe9 100644 (file)
@@ -32,6 +32,7 @@
 //%/////////////////////////////////////////////////////////////////////////////
 
 #include "EmbeddedServer.h"
+#include <Pegasus/Common/Logger.h>
 
 PEGASUS_NAMESPACE_BEGIN
 
@@ -60,4 +61,9 @@ void EmbeddedServer::installLoadRepositoryCallback(
     MemoryResidentRepository::installLoadCallback(callback, data);
 }
 
+void EmbeddedServer::installLogCallback(LogCallback callback, void* data)
+{
+    Logger::setLogCallback(callback, data);
+}
+
 PEGASUS_NAMESPACE_END
index b7ba85d9f1f37e8b94cd3b29ff9a47bfb47e364d..de012fa73a0bdbbf27546e5a2135be5f96404de2 100644 (file)
 //
 //%/////////////////////////////////////////////////////////////////////////////
 
-/* This module defines a class EmbeddedServer that provides functions for
-   defining the setup of embedded servers where the providers are statically
-   defined and the pegasus memory-resident CIM repository is used.
-   See PEP 305 and the embeddedsystembuild readmes for more detailed
-   information.
-*/
-
 #ifndef Pegasus_EmbeddedServer_h
 #define Pegasus_EmbeddedServer_h
 
 
 PEGASUS_NAMESPACE_BEGIN
 
+/** This module defines a class EmbeddedServer that provides functions for
+    defining the setup of embedded servers where the providers are statically
+    defined and the pegasus memory-resident CIM repository is used.
+    See PEP 305 and the embeddedsystembuild readmes for more detailed
+    information.
+*/
 class PEGASUS_SERVER_LINKAGE EmbeddedServer
 {
 public:
@@ -94,9 +93,12 @@ public:
      * of the function to load the instance repsository from
      * persistent storage and provide that set of instances to
      * Repository implementation.
+     *
      * @param callback defines the function that will be called
+     *
      * @param data void* pointer to data which will be passed to the
      * function defined by callback on each call.
+     *
      * Example: 
      *  
      *   static void _loadCallback(Buffer& buffer, void* data)
@@ -110,6 +112,28 @@ public:
         void (*callback)(Buffer& buffer, void* data),
         void* data);
 
+    /** Log callback, passed to installLogCallback().
+        @param type log type (1=TRACE, 2=STANDARD, 3=AUDIT, 4=ERROR, 5=DEBUG).
+        @param system name of system performing log.
+        @param level log level (1=TRACE, 2=INFO, 3=WARNING, 4=SEVERE, 5=FATAL).
+        @param message the localized log message.
+        @param data data passed to the callback.
+    */
+    typedef void (*LogCallback)(
+        int type,
+        const char* system,
+        int level,
+        const char* message,
+        void* data);
+
+    /** Install the callback used to add log records to the log. The
+        implementation of that log is left to the implementer.
+
+        @param callback the callback.
+        @param data data passed as last argument to callback.
+    */
+    static void installLogCallback(LogCallback callback, void* data);
+
 private:
 
     EmbeddedServer();
index e2c684acbe64637720c0905556f0cdda485a994c..29f49229161d24c553171f535589684dfd56739f 100644 (file)
@@ -1145,10 +1145,6 @@ int CIMServerProcess::cimserver_run(
 #endif
         }
 
-#if defined(PEGASUS_OS_VXWORKS)
-        cout << "Started CIM Server." << endl;
-#endif
-
 #if defined(PEGASUS_DEBUG)
         cout << "Started. " << endl;
 #endif
index c70a88966c28959509b4cdbc3b77baa696590400..bfc57c433f66b9654bf381eb8b3a2d8b19ee6927 100644 (file)
@@ -206,6 +206,22 @@ static void _saveCallback(const Buffer& buffer, void* data)
 #endif
 }
 
+// Logging callback:
+
+void _logCallback(
+        int type,
+        const char* system,
+        int level,
+        const char* message,
+        void* data)
+{
+    printf("LogCallback:\n");
+    printf("    type=%d\n", type);
+    printf("    system=%s\n", system);
+    printf("    level=%d\n", level);
+    printf("    message=%s\n", message);
+}
+
 // main function for the cimserver. Note that in this sample code the
 // main function is named cimserver because this example is based on
 // use of VxWorks and of the kernel mode rather than the
@@ -231,6 +247,10 @@ extern "C" int cimserver(int argc, char** argv)
     EmbeddedServer::installLoadRepositoryCallback(_loadCallback, 0);
     EmbeddedServer::installSaveRepositoryCallback(_saveCallback, 0);
 
+    // Install the log callback.
+
+    EmbeddedServer::installLogCallback(_logCallback, 0);
+
     // Run the pegasus server
     // for embedded systems, the cimserver main has been redefined
     // to PegasusServerMain, a Pegasus function.
index 1202f1cefea0e17069ed5bcc7fccba9becddd95e..cf92c3b16f0fc344735727c27f527c25f4a51be8 100644 (file)
@@ -1,42 +1,13 @@
-ROMFS=$(shell pwd)/romfs
-
 all: proj
-       ( cd proj; make TOOL=diab ROMFS_DIR=$(ROMFS) RAM_LOW_ADRS=07200000 RAM_HIGH_ADRS=07600000 )
+       (cd proj; make RAM_LOW_ADRS=07200000 RAM_HIGH_ADRS=07600000)
 
 proj:
        mkdir -p proj
+       cp pegasus.cdf proj
        ( cd proj; vxprj create iq8134x diab vxsim.wpj )
-       cp usrAppInit.c proj
-       ( cd proj; vxprj component add INCLUDE_POSIX_PTHREADS )
-       ( cd proj; vxprj component add INCLUDE_POSIX_SEM )
-       ( cd proj; vxprj component add INCLUDE_SHELL )
-       ( cd proj; vxprj component add INCLUDE_ROMFS )
-       ( cd proj; vxprj component add INCLUDE_SHELL_INTERP_CMD )
-       ( cd proj; vxprj component add INCLUDE_DISK_UTIL_SHELL_CMD )
-       ( cd proj; vxprj component add INCLUDE_CPLUS )
-       ( cd proj; vxprj component add INCLUDE_NFS )
-       ( cd proj; vxprj component add INCLUDE_NFS_CLIENT_ALL )
-       ( cd proj; vxprj component add INCLUDE_STARTUP_SCRIPT )
-       ( cd proj; vxprj component add INCLUDE_CPLUS_IOSTREAMS )
-       ( cd proj; vxprj component add INCLUDE_GETSERVBYNAME )
-       ( cd proj; vxprj component add INCLUDE_GETADDRINFO )
-       ( cd proj; vxprj component add INCLUDE_GETNAMEINFO )
-       ( cd proj; vxprj component add INCLUDE_GETNAMEINFO_SYSCTL )
-       ( cd proj; vxprj component add INCLUDE_GETNETBYNAME )
-       ( cd proj; vxprj component add INCLUDE_POSIX_CLOCKS )
-       ( cd proj; vxprj component add INCLUDE_POSIX_TIMERS )
-       ( cd proj; vxprj component add INCLUDE_PROTECT_TASK_STACK )
-       ( cd proj; vxprj parameter set JOB_TASK_STACK_SIZE 0x80000 )
-       ( cd proj; vxprj parameter set ROOT_STACK_SIZE 64000 )
-       ( cd proj; vxprj parameter set ISR_STACK_SIZE 50000 )
-       ( cd proj; vxprj parameter set TASK_USER_EXC_STACK_SIZE 32000 )
-       ( cd proj; vxprj parameter set NET_TASK_STACKSIZE 64000 )
-
-pre:
-       cp usrAppInit.c proj
 
 clean:
        rm -rf proj
 
 share:
-       cp proj/vxWorks /share/
+       cp proj/vxWorks /share/vxWorks
similarity index 79%
rename from vxworks/iq8134x/usrAppInit.c
rename to vxworks/iq8134x/pegasus.c
index d5853ae7cf99dfab64426ed6030d55e63ad2717a..cd41634933a78baf09df68befc17689533dde59d 100644 (file)
@@ -8,23 +8,15 @@
 #include <symLib.h>
 #include "prjParams.h"
 
-
-/******************************************************************************
-*
-* usrAppInit - initialize the users application
-*/ 
-
 IMPORT SYMTAB_ID sysSymTbl;
 
-static void load_cimserver(const char* root)
+static void _run_cimserver(const char* root)
 {
     char path[1024];
     int fd;
     char* value;
     SYM_TYPE type;
 
-
-
     /* Load cimserver module */
 
     sprintf(path, "%s/cimserver", root);
@@ -64,15 +56,10 @@ static void load_cimserver(const char* root)
     }
 }
 
-void usrAppInit (void)
+static void _mount_nfs(const char* path)
 {
-    const char path[] = "/share";
     int rc;
 
-    /* 
-     * NFS mount 
-     */
-
     rc = hostAdd("nfshost", "192.168.1.20");
 
     if (rc != 0)
@@ -88,10 +75,13 @@ void usrAppInit (void)
         printf("***** nfsMount() failed\n");
         return;
     }
+}
+
+void pegasusInit()
+{
+    const char nfs_root[] = "/share";
 
-    /*
-     * Load cimserver:
-     */
+    _mount_nfs(nfs_root);
 
-    load_cimserver(path);
+    _run_cimserver(nfs_root);
 }
diff --git a/vxworks/iq8134x/pegasus.cdf b/vxworks/iq8134x/pegasus.cdf
new file mode 100644 (file)
index 0000000..adbe210
--- /dev/null
@@ -0,0 +1,10 @@
+Component INCLUDE_PEGASUS {
+    NAME pegasus
+    INCLUDE_WHEN INCLUDE_KERNEL
+    REQUIRES INCLUDE_SHELL INCLUDE_SHELL_INTERP_CMD INCLUDE_DISK_UTIL_SHELL_CMD INCLUDE_NFS INCLUDE_NFS_CLIENT_ALL INCLUDE_CPLUS INCLUDE_CPLUS_IOSTREAMS INCLUDE_POSIX_PTHREADS INCLUDE_POSIX_SEM INCLUDE_POSIX_CLOCKS INCLUDE_POSIX_TIMERS INCLUDE_GETSERVBYNAME INCLUDE_GETADDRINFO INCLUDE_GETNAMEINFO INCLUDE_GETNAMEINFO_SYSCTL INCLUDE_GETNETBYNAME
+    CONFIGLETTES ../pegasus.c
+
+    INIT_RTN pegasusInit();
+    _INIT_ORDER usrRoot
+    INIT_BEFORE INCLUDE_USER_APPL
+}