You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2017/11/20 20:33:12 UTC

[15/46] celix git commit: CELIX-417: Initial refactoring for CMake usage

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/framework_private.h
----------------------------------------------------------------------
diff --git a/framework/src/framework_private.h b/framework/src/framework_private.h
new file mode 100644
index 0000000..124a4b6
--- /dev/null
+++ b/framework/src/framework_private.h
@@ -0,0 +1,145 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * framework_private.h
+ *
+ *  \date       May 22, 2013
+ *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
+ */
+
+
+#ifndef FRAMEWORK_PRIVATE_H_
+#define FRAMEWORK_PRIVATE_H_
+
+#include "framework.h"
+
+#include "manifest.h"
+#include "wire.h"
+#include "hash_map.h"
+#include "array_list.h"
+#include "celix_errno.h"
+#include "service_factory.h"
+#include "bundle_archive.h"
+#include "service_listener.h"
+#include "bundle_listener.h"
+#include "framework_listener.h"
+#include "service_registration.h"
+#include "bundle_context.h"
+#include "bundle_cache.h"
+#include "celix_log.h"
+
+#include "celix_threads.h"
+
+struct framework {
+#ifdef WITH_APR
+    apr_pool_t *pool;
+#endif
+    struct bundle * bundle;
+    hash_map_pt installedBundleMap;
+    hash_map_pt installRequestMap;
+    array_list_pt serviceListeners;
+    array_list_pt frameworkListeners;
+
+    array_list_pt bundleListeners;
+    celix_thread_mutex_t bundleListenerLock;
+
+    long nextBundleId;
+    struct serviceRegistry * registry;
+    bundle_cache_pt cache;
+
+    celix_thread_cond_t shutdownGate;
+    celix_thread_cond_t condition;
+
+    celix_thread_mutex_t installedBundleMapLock;
+    celix_thread_mutex_t installRequestLock;
+    celix_thread_mutex_t mutex;
+    celix_thread_mutex_t bundleLock;
+
+    celix_thread_t globalLockThread;
+    array_list_pt globalLockWaitersList;
+    int globalLockCount;
+
+    bool interrupted;
+    bool shutdown;
+
+    properties_pt configurationMap;
+
+    array_list_pt requests;
+    celix_thread_cond_t dispatcher;
+    celix_thread_mutex_t dispatcherLock;
+    celix_thread_t dispatcherThread;
+    celix_thread_t shutdownThread;
+
+    framework_logger_pt logger;
+};
+
+celix_status_t framework_start(framework_pt framework);
+void framework_stop(framework_pt framework);
+
+FRAMEWORK_EXPORT celix_status_t fw_getProperty(framework_pt framework, const char* name, const char* defaultValue, const char** value);
+
+FRAMEWORK_EXPORT celix_status_t fw_installBundle(framework_pt framework, bundle_pt * bundle, const char * location, const char *inputFile);
+FRAMEWORK_EXPORT celix_status_t fw_uninstallBundle(framework_pt framework, bundle_pt bundle);
+
+FRAMEWORK_EXPORT celix_status_t framework_getBundleEntry(framework_pt framework, bundle_pt bundle, const char* name, char** entry);
+
+FRAMEWORK_EXPORT celix_status_t fw_startBundle(framework_pt framework, bundle_pt bundle, int options);
+FRAMEWORK_EXPORT celix_status_t framework_updateBundle(framework_pt framework, bundle_pt bundle, const char* inputFile);
+FRAMEWORK_EXPORT celix_status_t fw_stopBundle(framework_pt framework, bundle_pt bundle, bool record);
+
+FRAMEWORK_EXPORT celix_status_t fw_registerService(framework_pt framework, service_registration_pt * registration, bundle_pt bundle, const char* serviceName, const void* svcObj, properties_pt properties);
+FRAMEWORK_EXPORT celix_status_t fw_registerServiceFactory(framework_pt framework, service_registration_pt * registration, bundle_pt bundle, const char* serviceName, service_factory_pt factory, properties_pt properties);
+FRAMEWORK_EXPORT void fw_unregisterService(service_registration_pt registration);
+
+FRAMEWORK_EXPORT celix_status_t fw_getServiceReferences(framework_pt framework, array_list_pt *references, bundle_pt bundle, const char* serviceName, const char* filter);
+FRAMEWORK_EXPORT celix_status_t framework_ungetServiceReference(framework_pt framework, bundle_pt bundle, service_reference_pt reference);
+FRAMEWORK_EXPORT celix_status_t fw_getService(framework_pt framework, bundle_pt bundle, service_reference_pt reference, const void** service);
+FRAMEWORK_EXPORT celix_status_t framework_ungetService(framework_pt framework, bundle_pt bundle, service_reference_pt reference, bool *result);
+FRAMEWORK_EXPORT celix_status_t fw_getBundleRegisteredServices(framework_pt framework, bundle_pt bundle, array_list_pt *services);
+FRAMEWORK_EXPORT celix_status_t fw_getBundleServicesInUse(framework_pt framework, bundle_pt bundle, array_list_pt *services);
+
+FRAMEWORK_EXPORT void fw_addServiceListener(framework_pt framework, bundle_pt bundle, service_listener_pt listener, const char* filter);
+FRAMEWORK_EXPORT void fw_removeServiceListener(framework_pt framework, bundle_pt bundle, service_listener_pt listener);
+
+FRAMEWORK_EXPORT celix_status_t fw_addBundleListener(framework_pt framework, bundle_pt bundle, bundle_listener_pt listener);
+FRAMEWORK_EXPORT celix_status_t fw_removeBundleListener(framework_pt framework, bundle_pt bundle, bundle_listener_pt listener);
+
+FRAMEWORK_EXPORT celix_status_t fw_addFrameworkListener(framework_pt framework, bundle_pt bundle, framework_listener_pt listener);
+FRAMEWORK_EXPORT celix_status_t fw_removeFrameworkListener(framework_pt framework, bundle_pt bundle, framework_listener_pt listener);
+
+FRAMEWORK_EXPORT void fw_serviceChanged(framework_pt framework, service_event_type_e eventType, service_registration_pt registration, properties_pt oldprops);
+
+FRAMEWORK_EXPORT celix_status_t fw_isServiceAssignable(framework_pt fw, bundle_pt requester, service_reference_pt reference, bool* assignable);
+
+//bundle_archive_t fw_createArchive(long id, char * location);
+//void revise(bundle_archive_t archive, char * location);
+FRAMEWORK_EXPORT celix_status_t getManifest(bundle_archive_pt archive, manifest_pt *manifest);
+
+FRAMEWORK_EXPORT bundle_pt findBundle(bundle_context_pt context);
+FRAMEWORK_EXPORT service_registration_pt findRegistration(service_reference_pt reference);
+
+FRAMEWORK_EXPORT service_reference_pt listToArray(array_list_pt list);
+FRAMEWORK_EXPORT celix_status_t framework_markResolvedModules(framework_pt framework, linked_list_pt wires);
+
+FRAMEWORK_EXPORT array_list_pt framework_getBundles(framework_pt framework);
+FRAMEWORK_EXPORT bundle_pt framework_getBundle(framework_pt framework, const char* location);
+FRAMEWORK_EXPORT bundle_pt framework_getBundleById(framework_pt framework, long id);
+
+#endif /* FRAMEWORK_PRIVATE_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/ioapi.c
----------------------------------------------------------------------
diff --git a/framework/src/ioapi.c b/framework/src/ioapi.c
new file mode 100644
index 0000000..49958f6
--- /dev/null
+++ b/framework/src/ioapi.c
@@ -0,0 +1,235 @@
+/* ioapi.h -- IO base function header for compress/uncompress .zip
+   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Modifications for Zip64 support
+         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+
+         For more info read MiniZip_info.txt
+
+*/
+
+#if (defined(_WIN32))
+        #define _CRT_SECURE_NO_WARNINGS
+#endif
+
+#include "ioapi.h"
+
+voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
+{
+    if (pfilefunc->zfile_func64.zopen64_file != NULL)
+        return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
+    else
+    {
+        return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode);
+    }
+}
+
+long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)
+{
+    if (pfilefunc->zfile_func64.zseek64_file != NULL)
+        return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
+    else
+    {
+        uLong offsetTruncated = (uLong)offset;
+        if (offsetTruncated != offset)
+            return -1;
+        else
+            return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin);
+    }
+}
+
+ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)
+{
+    if (pfilefunc->zfile_func64.zseek64_file != NULL)
+        return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
+    else
+    {
+        uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
+        if ((tell_uLong) == ((uLong)-1))
+            return (ZPOS64_T)-1;
+        else
+            return tell_uLong;
+    }
+}
+
+void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32)
+{
+    p_filefunc64_32->zfile_func64.zopen64_file = NULL;
+    p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
+    p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
+    p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
+    p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
+    p_filefunc64_32->zfile_func64.ztell64_file = NULL;
+    p_filefunc64_32->zfile_func64.zseek64_file = NULL;
+    p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file;
+    p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
+    p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
+    p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
+    p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
+}
+
+
+
+static voidpf  ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
+static uLong   ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
+static uLong   ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
+static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
+static long    ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
+static int     ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
+static int     ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
+
+static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
+{
+    FILE* file = NULL;
+    const char* mode_fopen = NULL;
+    if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
+        mode_fopen = "rb";
+    else
+    if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
+        mode_fopen = "r+b";
+    else
+    if (mode & ZLIB_FILEFUNC_MODE_CREATE)
+        mode_fopen = "wb";
+
+    if ((filename!=NULL) && (mode_fopen != NULL))
+        file = fopen(filename, mode_fopen);
+    return file;
+}
+
+static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
+{
+    FILE* file = NULL;
+    const char* mode_fopen = NULL;
+    if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
+        mode_fopen = "rb";
+    else
+    if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
+        mode_fopen = "r+b";
+    else
+    if (mode & ZLIB_FILEFUNC_MODE_CREATE)
+        mode_fopen = "wb";
+
+    if ((filename!=NULL) && (mode_fopen != NULL))
+        file = fopen64((const char*)filename, mode_fopen);
+    return file;
+}
+
+
+static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
+{
+    uLong ret;
+    ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
+    return ret;
+}
+
+static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
+{
+    uLong ret;
+    ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
+    return ret;
+}
+
+static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
+{
+    long ret;
+    ret = ftell((FILE *)stream);
+    return ret;
+}
+
+
+static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
+{
+    ZPOS64_T ret;
+    ret = ftello64((FILE *)stream);
+    return ret;
+}
+
+static long ZCALLBACK fseek_file_func (voidpf  opaque, voidpf stream, uLong offset, int origin)
+{
+    int fseek_origin=0;
+    long ret;
+    switch (origin)
+    {
+    case ZLIB_FILEFUNC_SEEK_CUR :
+        fseek_origin = SEEK_CUR;
+        break;
+    case ZLIB_FILEFUNC_SEEK_END :
+        fseek_origin = SEEK_END;
+        break;
+    case ZLIB_FILEFUNC_SEEK_SET :
+        fseek_origin = SEEK_SET;
+        break;
+    default: return -1;
+    }
+    ret = 0;
+    if (fseek((FILE *)stream, offset, fseek_origin) != 0)
+        ret = -1;
+    return ret;
+}
+
+static long ZCALLBACK fseek64_file_func (voidpf  opaque, voidpf stream, ZPOS64_T offset, int origin)
+{
+    int fseek_origin=0;
+    long ret;
+    switch (origin)
+    {
+    case ZLIB_FILEFUNC_SEEK_CUR :
+        fseek_origin = SEEK_CUR;
+        break;
+    case ZLIB_FILEFUNC_SEEK_END :
+        fseek_origin = SEEK_END;
+        break;
+    case ZLIB_FILEFUNC_SEEK_SET :
+        fseek_origin = SEEK_SET;
+        break;
+    default: return -1;
+    }
+    ret = 0;
+
+    if(fseeko64((FILE *)stream, offset, fseek_origin) != 0)
+                        ret = -1;
+
+    return ret;
+}
+
+
+static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
+{
+    int ret;
+    ret = fclose((FILE *)stream);
+    return ret;
+}
+
+static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
+{
+    int ret;
+    ret = ferror((FILE *)stream);
+    return ret;
+}
+
+void fill_fopen_filefunc (pzlib_filefunc_def)
+  zlib_filefunc_def* pzlib_filefunc_def;
+{
+    pzlib_filefunc_def->zopen_file = fopen_file_func;
+    pzlib_filefunc_def->zread_file = fread_file_func;
+    pzlib_filefunc_def->zwrite_file = fwrite_file_func;
+    pzlib_filefunc_def->ztell_file = ftell_file_func;
+    pzlib_filefunc_def->zseek_file = fseek_file_func;
+    pzlib_filefunc_def->zclose_file = fclose_file_func;
+    pzlib_filefunc_def->zerror_file = ferror_file_func;
+    pzlib_filefunc_def->opaque = NULL;
+}
+
+void fill_fopen64_filefunc (zlib_filefunc64_def*  pzlib_filefunc_def)
+{
+    pzlib_filefunc_def->zopen64_file = fopen64_file_func;
+    pzlib_filefunc_def->zread_file = fread_file_func;
+    pzlib_filefunc_def->zwrite_file = fwrite_file_func;
+    pzlib_filefunc_def->ztell64_file = ftell64_file_func;
+    pzlib_filefunc_def->zseek64_file = fseek64_file_func;
+    pzlib_filefunc_def->zclose_file = fclose_file_func;
+    pzlib_filefunc_def->zerror_file = ferror_file_func;
+    pzlib_filefunc_def->opaque = NULL;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/ioapi.h
----------------------------------------------------------------------
diff --git a/framework/src/ioapi.h b/framework/src/ioapi.h
new file mode 100644
index 0000000..8309c4c
--- /dev/null
+++ b/framework/src/ioapi.h
@@ -0,0 +1,200 @@
+/* ioapi.h -- IO base function header for compress/uncompress .zip
+   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Modifications for Zip64 support
+         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+
+         For more info read MiniZip_info.txt
+
+         Changes
+
+    Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this)
+    Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux.
+               More if/def section may be needed to support other platforms
+    Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows.
+                          (but you should use iowin32.c for windows instead)
+
+*/
+
+#ifndef _ZLIBIOAPI64_H
+#define _ZLIBIOAPI64_H
+
+#if (!defined(_WIN32)) && (!defined(WIN32))
+
+  // Linux needs this to support file operation on files larger then 4+GB
+  // But might need better if/def to select just the platforms that needs them.
+
+        #ifndef __USE_FILE_OFFSET64
+                #define __USE_FILE_OFFSET64
+        #endif
+        #ifndef __USE_LARGEFILE64
+                #define __USE_LARGEFILE64
+        #endif
+        #ifndef _LARGEFILE64_SOURCE
+                #define _LARGEFILE64_SOURCE
+        #endif
+        #ifndef _FILE_OFFSET_BIT
+                #define _FILE_OFFSET_BIT 64
+        #endif
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "zlib.h"
+
+#if defined(USE_FILE32API)
+#define fopen64 fopen
+#define ftello64 ftell
+#define fseeko64 fseek
+#else
+#ifdef _MSC_VER
+ #define fopen64 fopen
+ #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
+  #define ftello64 _ftelli64
+  #define fseeko64 _fseeki64
+ #else // old MSC
+  #define ftello64 ftell
+  #define fseeko64 fseek
+ #endif
+#endif
+#endif
+
+/*
+#ifndef ZPOS64_T
+  #ifdef _WIN32
+                #define ZPOS64_T fpos_t
+  #else
+    #include <stdint.h>
+    #define ZPOS64_T uint64_t
+  #endif
+#endif
+*/
+
+#ifdef HAVE_MINIZIP64_CONF_H
+#include "mz64conf.h"
+#endif
+
+/* a type choosen by DEFINE */
+#ifdef HAVE_64BIT_INT_CUSTOM
+typedef  64BIT_INT_CUSTOM_TYPE ZPOS64_T;
+#else
+#ifdef HAS_STDINT_H
+#include "stdint.h"
+typedef uint64_t ZPOS64_T;
+#else
+
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+typedef unsigned __int64 ZPOS64_T;
+#else
+typedef unsigned long long int ZPOS64_T;
+#endif
+#endif
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define ZLIB_FILEFUNC_SEEK_CUR (1)
+#define ZLIB_FILEFUNC_SEEK_END (2)
+#define ZLIB_FILEFUNC_SEEK_SET (0)
+
+#define ZLIB_FILEFUNC_MODE_READ      (1)
+#define ZLIB_FILEFUNC_MODE_WRITE     (2)
+#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
+
+#define ZLIB_FILEFUNC_MODE_EXISTING (4)
+#define ZLIB_FILEFUNC_MODE_CREATE   (8)
+
+
+#ifndef ZCALLBACK
+ #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
+   #define ZCALLBACK CALLBACK
+ #else
+   #define ZCALLBACK
+ #endif
+#endif
+
+
+
+
+typedef voidpf   (ZCALLBACK *open_file_func)      OF((voidpf opaque, const char* filename, int mode));
+typedef uLong    (ZCALLBACK *read_file_func)      OF((voidpf opaque, voidpf stream, void* buf, uLong size));
+typedef uLong    (ZCALLBACK *write_file_func)     OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
+typedef int      (ZCALLBACK *close_file_func)     OF((voidpf opaque, voidpf stream));
+typedef int      (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
+
+typedef long     (ZCALLBACK *tell_file_func)      OF((voidpf opaque, voidpf stream));
+typedef long     (ZCALLBACK *seek_file_func)      OF((voidpf opaque, voidpf stream, uLong offset, int origin));
+
+
+/* here is the "old" 32 bits structure structure */
+typedef struct zlib_filefunc_def_s
+{
+    open_file_func      zopen_file;
+    read_file_func      zread_file;
+    write_file_func     zwrite_file;
+    tell_file_func      ztell_file;
+    seek_file_func      zseek_file;
+    close_file_func     zclose_file;
+    testerror_file_func zerror_file;
+    voidpf              opaque;
+} zlib_filefunc_def;
+
+typedef ZPOS64_T (ZCALLBACK *tell64_file_func)    OF((voidpf opaque, voidpf stream));
+typedef long     (ZCALLBACK *seek64_file_func)    OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
+typedef voidpf   (ZCALLBACK *open64_file_func)    OF((voidpf opaque, const void* filename, int mode));
+
+typedef struct zlib_filefunc64_def_s
+{
+    open64_file_func    zopen64_file;
+    read_file_func      zread_file;
+    write_file_func     zwrite_file;
+    tell64_file_func    ztell64_file;
+    seek64_file_func    zseek64_file;
+    close_file_func     zclose_file;
+    testerror_file_func zerror_file;
+    voidpf              opaque;
+} zlib_filefunc64_def;
+
+void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
+void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
+
+/* now internal definition, only for zip.c and unzip.h */
+typedef struct zlib_filefunc64_32_def_s
+{
+    zlib_filefunc64_def zfile_func64;
+    open_file_func      zopen32_file;
+    tell_file_func      ztell32_file;
+    seek_file_func      zseek32_file;
+} zlib_filefunc64_32_def;
+
+
+#define ZREAD64(filefunc,filestream,buf,size)     ((*((filefunc).zfile_func64.zread_file))   ((filefunc).zfile_func64.opaque,filestream,buf,size))
+#define ZWRITE64(filefunc,filestream,buf,size)    ((*((filefunc).zfile_func64.zwrite_file))  ((filefunc).zfile_func64.opaque,filestream,buf,size))
+//#define ZTELL64(filefunc,filestream)            ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))
+//#define ZSEEK64(filefunc,filestream,pos,mode)   ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))
+#define ZCLOSE64(filefunc,filestream)             ((*((filefunc).zfile_func64.zclose_file))  ((filefunc).zfile_func64.opaque,filestream))
+#define ZERROR64(filefunc,filestream)             ((*((filefunc).zfile_func64.zerror_file))  ((filefunc).zfile_func64.opaque,filestream))
+
+voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
+long    call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
+ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
+
+void    fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
+
+#define ZOPEN64(filefunc,filename,mode)         (call_zopen64((&(filefunc)),(filename),(mode)))
+#define ZTELL64(filefunc,filestream)            (call_ztell64((&(filefunc)),(filestream)))
+#define ZSEEK64(filefunc,filestream,pos,mode)   (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/iowin32.c
----------------------------------------------------------------------
diff --git a/framework/src/iowin32.c b/framework/src/iowin32.c
new file mode 100644
index 0000000..6a2a883
--- /dev/null
+++ b/framework/src/iowin32.c
@@ -0,0 +1,389 @@
+/* iowin32.c -- IO base function header for compress/uncompress .zip
+     Version 1.1, February 14h, 2010
+     part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Modifications for Zip64 support
+         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+
+     For more info read MiniZip_info.txt
+
+*/
+
+#include <stdlib.h>
+
+#include "zlib.h"
+#include "ioapi.h"
+#include "iowin32.h"
+
+#ifndef INVALID_HANDLE_VALUE
+#define INVALID_HANDLE_VALUE (0xFFFFFFFF)
+#endif
+
+#ifndef INVALID_SET_FILE_POINTER
+#define INVALID_SET_FILE_POINTER ((DWORD)-1)
+#endif
+
+voidpf  ZCALLBACK win32_open_file_func  OF((voidpf opaque, const char* filename, int mode));
+uLong   ZCALLBACK win32_read_file_func  OF((voidpf opaque, voidpf stream, void* buf, uLong size));
+uLong   ZCALLBACK win32_write_file_func OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
+ZPOS64_T ZCALLBACK win32_tell64_file_func  OF((voidpf opaque, voidpf stream));
+long    ZCALLBACK win32_seek64_file_func  OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
+int     ZCALLBACK win32_close_file_func OF((voidpf opaque, voidpf stream));
+int     ZCALLBACK win32_error_file_func OF((voidpf opaque, voidpf stream));
+
+typedef struct
+{
+    HANDLE hf;
+    int error;
+} WIN32FILE_IOWIN;
+
+
+static void win32_translate_open_mode(int mode,
+                                      DWORD* lpdwDesiredAccess,
+                                      DWORD* lpdwCreationDisposition,
+                                      DWORD* lpdwShareMode,
+                                      DWORD* lpdwFlagsAndAttributes)
+{
+    *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0;
+
+    if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
+    {
+        *lpdwDesiredAccess = GENERIC_READ;
+        *lpdwCreationDisposition = OPEN_EXISTING;
+        *lpdwShareMode = FILE_SHARE_READ;
+    }
+    else if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
+    {
+        *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
+        *lpdwCreationDisposition = OPEN_EXISTING;
+    }
+    else if (mode & ZLIB_FILEFUNC_MODE_CREATE)
+    {
+        *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
+        *lpdwCreationDisposition = CREATE_ALWAYS;
+    }
+}
+
+static voidpf win32_build_iowin(HANDLE hFile)
+{
+    voidpf ret=NULL;
+
+    if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE))
+    {
+        WIN32FILE_IOWIN w32fiow;
+        w32fiow.hf = hFile;
+        w32fiow.error = 0;
+        ret = malloc(sizeof(WIN32FILE_IOWIN));
+
+        if (ret==NULL)
+            CloseHandle(hFile);
+        else
+            *((WIN32FILE_IOWIN*)ret) = w32fiow;
+    }
+    return ret;
+}
+
+voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int mode)
+{
+    const char* mode_fopen = NULL;
+    DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
+    HANDLE hFile = NULL;
+
+    win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
+
+    if ((filename!=NULL) && (dwDesiredAccess != 0))
+        hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
+
+    return win32_build_iowin(hFile);
+}
+
+
+voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int mode)
+{
+    const char* mode_fopen = NULL;
+    DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
+    HANDLE hFile = NULL;
+
+    win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
+
+    if ((filename!=NULL) && (dwDesiredAccess != 0))
+        hFile = CreateFileA((LPCSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
+
+    return win32_build_iowin(hFile);
+}
+
+
+voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int mode)
+{
+    const char* mode_fopen = NULL;
+    DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
+    HANDLE hFile = NULL;
+
+    win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
+
+    if ((filename!=NULL) && (dwDesiredAccess != 0))
+        hFile = CreateFileW((LPCWSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
+
+    return win32_build_iowin(hFile);
+}
+
+
+voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mode)
+{
+    const char* mode_fopen = NULL;
+    DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
+    HANDLE hFile = NULL;
+
+    win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
+
+    if ((filename!=NULL) && (dwDesiredAccess != 0))
+        hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
+
+    return win32_build_iowin(hFile);
+}
+
+
+uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uLong size)
+{
+    uLong ret=0;
+    HANDLE hFile = NULL;
+    if (stream!=NULL)
+        hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
+
+    if (hFile != NULL)
+    {
+        if (!ReadFile(hFile, buf, size, &ret, NULL))
+        {
+            DWORD dwErr = GetLastError();
+            if (dwErr == ERROR_HANDLE_EOF)
+                dwErr = 0;
+            ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
+        }
+    }
+
+    return ret;
+}
+
+
+uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* buf,uLong size)
+{
+    uLong ret=0;
+    HANDLE hFile = NULL;
+    if (stream!=NULL)
+        hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
+
+    if (hFile != NULL)
+    {
+        if (!WriteFile(hFile, buf, size, &ret, NULL))
+        {
+            DWORD dwErr = GetLastError();
+            if (dwErr == ERROR_HANDLE_EOF)
+                dwErr = 0;
+            ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
+        }
+    }
+
+    return ret;
+}
+
+long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream)
+{
+    long ret=-1;
+    HANDLE hFile = NULL;
+    if (stream!=NULL)
+        hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
+    if (hFile != NULL)
+    {
+        DWORD dwSet = SetFilePointer(hFile, 0, NULL, FILE_CURRENT);
+        if (dwSet == INVALID_SET_FILE_POINTER)
+        {
+            DWORD dwErr = GetLastError();
+            ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
+            ret = -1;
+        }
+        else
+            ret=(long)dwSet;
+    }
+    return ret;
+}
+
+ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream)
+{
+    ZPOS64_T ret= (ZPOS64_T)-1;
+    HANDLE hFile = NULL;
+    if (stream!=NULL)
+        hFile = ((WIN32FILE_IOWIN*)stream)->hf;
+
+    if (hFile)
+    {
+        LARGE_INTEGER li;
+        li.QuadPart = 0;
+        li.u.LowPart = SetFilePointer(hFile, li.u.LowPart, &li.u.HighPart, FILE_CURRENT);
+        if ( (li.LowPart == 0xFFFFFFFF) && (GetLastError() != NO_ERROR))
+        {
+            DWORD dwErr = GetLastError();
+            ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
+            ret = (ZPOS64_T)-1;
+        }
+        else
+            ret=li.QuadPart;
+    }
+    return ret;
+}
+
+
+long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,int origin)
+{
+    DWORD dwMoveMethod=0xFFFFFFFF;
+    HANDLE hFile = NULL;
+
+    long ret=-1;
+    if (stream!=NULL)
+        hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
+    switch (origin)
+    {
+    case ZLIB_FILEFUNC_SEEK_CUR :
+        dwMoveMethod = FILE_CURRENT;
+        break;
+    case ZLIB_FILEFUNC_SEEK_END :
+        dwMoveMethod = FILE_END;
+        break;
+    case ZLIB_FILEFUNC_SEEK_SET :
+        dwMoveMethod = FILE_BEGIN;
+        break;
+    default: return -1;
+    }
+
+    if (hFile != NULL)
+    {
+        DWORD dwSet = SetFilePointer(hFile, offset, NULL, dwMoveMethod);
+        if (dwSet == INVALID_SET_FILE_POINTER)
+        {
+            DWORD dwErr = GetLastError();
+            ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
+            ret = -1;
+        }
+        else
+            ret=0;
+    }
+    return ret;
+}
+
+long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T offset,int origin)
+{
+    DWORD dwMoveMethod=0xFFFFFFFF;
+    HANDLE hFile = NULL;
+    long ret=-1;
+
+    if (stream!=NULL)
+        hFile = ((WIN32FILE_IOWIN*)stream)->hf;
+
+    switch (origin)
+    {
+        case ZLIB_FILEFUNC_SEEK_CUR :
+            dwMoveMethod = FILE_CURRENT;
+            break;
+        case ZLIB_FILEFUNC_SEEK_END :
+            dwMoveMethod = FILE_END;
+            break;
+        case ZLIB_FILEFUNC_SEEK_SET :
+            dwMoveMethod = FILE_BEGIN;
+            break;
+        default: return -1;
+    }
+
+    if (hFile)
+    {
+        LARGE_INTEGER* li = (LARGE_INTEGER*)&offset;
+        DWORD dwSet = SetFilePointer(hFile, li->u.LowPart, &li->u.HighPart, dwMoveMethod);
+        if (dwSet == INVALID_SET_FILE_POINTER)
+        {
+            DWORD dwErr = GetLastError();
+            ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
+            ret = -1;
+        }
+        else
+            ret=0;
+    }
+    return ret;
+}
+
+int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream)
+{
+    int ret=-1;
+
+    if (stream!=NULL)
+    {
+        HANDLE hFile;
+        hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
+        if (hFile != NULL)
+        {
+            CloseHandle(hFile);
+            ret=0;
+        }
+        free(stream);
+    }
+    return ret;
+}
+
+int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream)
+{
+    int ret=-1;
+    if (stream!=NULL)
+    {
+        ret = ((WIN32FILE_IOWIN*)stream) -> error;
+    }
+    return ret;
+}
+
+void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def)
+{
+    pzlib_filefunc_def->zopen_file = win32_open_file_func;
+    pzlib_filefunc_def->zread_file = win32_read_file_func;
+    pzlib_filefunc_def->zwrite_file = win32_write_file_func;
+    pzlib_filefunc_def->ztell_file = win32_tell_file_func;
+    pzlib_filefunc_def->zseek_file = win32_seek_file_func;
+    pzlib_filefunc_def->zclose_file = win32_close_file_func;
+    pzlib_filefunc_def->zerror_file = win32_error_file_func;
+    pzlib_filefunc_def->opaque = NULL;
+}
+
+void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def)
+{
+    pzlib_filefunc_def->zopen64_file = win32_open64_file_func;
+    pzlib_filefunc_def->zread_file = win32_read_file_func;
+    pzlib_filefunc_def->zwrite_file = win32_write_file_func;
+    pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
+    pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
+    pzlib_filefunc_def->zclose_file = win32_close_file_func;
+    pzlib_filefunc_def->zerror_file = win32_error_file_func;
+    pzlib_filefunc_def->opaque = NULL;
+}
+
+
+void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def)
+{
+    pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA;
+    pzlib_filefunc_def->zread_file = win32_read_file_func;
+    pzlib_filefunc_def->zwrite_file = win32_write_file_func;
+    pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
+    pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
+    pzlib_filefunc_def->zclose_file = win32_close_file_func;
+    pzlib_filefunc_def->zerror_file = win32_error_file_func;
+    pzlib_filefunc_def->opaque = NULL;
+}
+
+
+void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def)
+{
+    pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW;
+    pzlib_filefunc_def->zread_file = win32_read_file_func;
+    pzlib_filefunc_def->zwrite_file = win32_write_file_func;
+    pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
+    pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
+    pzlib_filefunc_def->zclose_file = win32_close_file_func;
+    pzlib_filefunc_def->zerror_file = win32_error_file_func;
+    pzlib_filefunc_def->opaque = NULL;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/iowin32.h
----------------------------------------------------------------------
diff --git a/framework/src/iowin32.h b/framework/src/iowin32.h
new file mode 100644
index 0000000..0ca0969
--- /dev/null
+++ b/framework/src/iowin32.h
@@ -0,0 +1,28 @@
+/* iowin32.h -- IO base function header for compress/uncompress .zip
+     Version 1.1, February 14h, 2010
+     part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Modifications for Zip64 support
+         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+
+         For more info read MiniZip_info.txt
+
+*/
+
+#include <windows.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
+void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def));
+void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def));
+void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def));
+
+#ifdef __cplusplus
+}
+#endif

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/listener_hook_info_impl.h
----------------------------------------------------------------------
diff --git a/framework/src/listener_hook_info_impl.h b/framework/src/listener_hook_info_impl.h
new file mode 100644
index 0000000..4b45710
--- /dev/null
+++ b/framework/src/listener_hook_info_impl.h
@@ -0,0 +1,34 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * listener_hook_info_impl.h
+ *
+ *  \date       Oct 28, 2011
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+#ifndef LISTENER_HOOK_INFO_IMPL_H_
+#define LISTENER_HOOK_INFO_IMPL_H_
+
+#include "celix_errno.h"
+
+celix_status_t listenerHookInfo_create();
+
+#endif /* LISTENER_HOOK_INFO_IMPL_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/manifest.c
----------------------------------------------------------------------
diff --git a/framework/src/manifest.c b/framework/src/manifest.c
new file mode 100644
index 0000000..29b155a
--- /dev/null
+++ b/framework/src/manifest.c
@@ -0,0 +1,271 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * manifest.c
+ *
+ *  \date       Jul 5, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "celixbool.h"
+
+#include "manifest.h"
+#include "utils.h"
+#include "celix_log.h"
+
+int fpeek(FILE *stream);
+celix_status_t manifest_readAttributes(manifest_pt manifest, properties_pt properties, FILE *file);
+
+celix_status_t manifest_create(manifest_pt *manifest) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	*manifest = malloc(sizeof(**manifest));
+	if (!*manifest) {
+		status = CELIX_ENOMEM;
+	} else {
+		(*manifest)->mainAttributes = properties_create();
+		(*manifest)->attributes = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+	}
+
+	framework_logIfError(logger, status, NULL, "Cannot create manifest");
+
+	return status;
+}
+
+celix_status_t manifest_destroy(manifest_pt manifest) {
+	if (manifest != NULL) {
+	    properties_destroy(manifest->mainAttributes);
+		hashMap_destroy(manifest->attributes, true, false);
+		manifest->mainAttributes = NULL;
+		manifest->attributes = NULL;
+		free(manifest);
+		manifest = NULL;
+	}
+	return CELIX_SUCCESS;
+}
+
+celix_status_t manifest_createFromFile(const char *filename, manifest_pt *manifest) {
+	celix_status_t status;
+
+	status = manifest_create(manifest);
+
+	if (status == CELIX_SUCCESS) {
+		manifest_read(*manifest, filename);
+	}
+
+	framework_logIfError(logger, status, NULL, "Cannot create manifest from file");
+
+	return status;
+}
+
+void manifest_clear(manifest_pt manifest) {
+
+}
+
+properties_pt manifest_getMainAttributes(manifest_pt manifest) {
+	return manifest->mainAttributes;
+}
+
+celix_status_t manifest_getEntries(manifest_pt manifest, hash_map_pt *map) {
+	*map = manifest->attributes;
+	return CELIX_SUCCESS;
+}
+
+celix_status_t manifest_read(manifest_pt manifest, const char *filename) {
+    celix_status_t status = CELIX_SUCCESS;
+
+	FILE *file = fopen ( filename, "r" );
+	if (file != NULL) {
+		char lbuf[512];
+		char name[512];
+		bool skipEmptyLines = true;
+		char lastline[512];
+		memset(lbuf,0,512);
+		memset(name,0,512);
+		memset(lastline,0,512);
+
+		manifest_readAttributes(manifest, manifest->mainAttributes, file);
+		
+		while (status==CELIX_SUCCESS && fgets(lbuf, sizeof(lbuf), file) != NULL) {
+			properties_pt attributes;
+			int len = strlen(lbuf);
+
+			if (lbuf[--len] != '\n') {
+				status = CELIX_FILE_IO_EXCEPTION;
+				framework_logIfError(logger, status, NULL, "Manifest '%s' line too long", filename);
+				break;
+			}
+			if (len > 0 && lbuf[len - 1] == '\r') {
+				--len;
+			}
+			if (len == 0 && skipEmptyLines) {
+				continue;
+			}
+			skipEmptyLines = false;
+
+			if (strlen(name) == 0) {
+				
+				if ((tolower(lbuf[0]) == 'n') && (tolower(lbuf[1]) == 'a') &&
+					(tolower(lbuf[2]) == 'm') && (tolower(lbuf[3]) == 'e') &&
+					(lbuf[4] == ':') && (lbuf[5] == ' ')) {
+					name[0] = '\0';
+					strncpy(name, lbuf+6, len - 6);
+					name[len - 6] = '\0';
+				} else {
+					status = CELIX_FILE_IO_EXCEPTION;
+					framework_logIfError(logger, status, NULL, "Manifest '%s' invalid format", filename);
+					break;
+				}
+
+				if (fpeek(file) == ' ') {
+					int newlen = len - 6;
+					lastline[0] = '\0';
+					strncpy(lastline, lbuf+6, len - 6);
+					lastline[newlen] = '\0';
+					continue;
+				}
+			} else {
+				int newlen = strlen(lastline) + len;
+				char buf[512];
+				buf[0] = '\0';
+				strcpy(buf, lastline);
+				strncat(buf, lbuf+1, len - 1);
+				buf[newlen] = '\0';
+
+				if (fpeek(file) == ' ') {
+//					lastline = realloc(lastline, strlen(buf) + 1);
+					lastline[0] = '\0';
+					strcpy(lastline, buf);
+					continue;
+				}
+				name[0] = '\0';
+				strcpy(name, buf);
+				name[strlen(buf)] = '\0';
+			}
+
+			attributes = hashMap_get(manifest->attributes, name);
+			if (attributes == NULL) {
+				attributes = properties_create();
+				hashMap_put(manifest->attributes, strdup(name), attributes);
+			}
+			manifest_readAttributes(manifest, attributes, file);
+
+			name[0] = '\0';
+			skipEmptyLines = true;
+		}
+		fclose(file);
+	} else {
+		status = CELIX_FILE_IO_EXCEPTION;
+	}
+
+	framework_logIfError(logger, status, NULL, "Cannot read manifest");
+
+	return status;
+}
+
+void manifest_write(manifest_pt manifest, const char * filename) {
+
+}
+
+const char* manifest_getValue(manifest_pt manifest, const char* name) {
+	const char* val = properties_get(manifest->mainAttributes, name);
+	bool isEmpty = utils_isStringEmptyOrNull(val);
+	return isEmpty ? NULL : val;
+}
+
+int fpeek(FILE *stream) {
+	int c;
+	c = fgetc(stream);
+	ungetc(c, stream);
+	return c;
+}
+
+celix_status_t manifest_readAttributes(manifest_pt manifest, properties_pt properties, FILE *file) {
+	char name[512]; memset(name,0,512);
+	char value[512]; memset(value,0,512);
+	char lastLine[512]; memset(lastLine,0,512);
+	char lbuf[512]; memset(lbuf,0,512);
+
+
+	while (fgets(lbuf, sizeof(lbuf), file ) != NULL ) {
+		int len = strlen(lbuf);
+
+		if (lbuf[--len] != '\n') {
+			printf("MANIFEST: Line too long\n");
+			return CELIX_FILE_IO_EXCEPTION;
+		}
+		if (len > 0 && lbuf[len - 1] == '\r') {
+			--len;
+		}
+		if (len == 0) {
+			break;
+		}
+		
+		if (lbuf[0] == ' ') {
+			char buf[512];
+			buf[0] = '\0';
+
+			// Line continued
+			strcat(buf, lastLine);
+			strncat(buf, lbuf+1, len - 1);
+
+			if (fpeek(file) == ' ') {
+//				lastLine = realloc(lastLine, strlen(buf) + 1);
+				lastLine[0] = '\0';
+				strcpy(lastLine, buf);
+				continue;
+			}
+			value[0] = '\0';
+			strcpy(value, buf);
+		} else {
+	        int i = 0;
+			while (lbuf[i++] != ':') {
+				if (i >= len) {
+					printf("MANIFEST: Invalid header\n");
+					return CELIX_FILE_IO_EXCEPTION;
+				}
+			}
+			if (lbuf[i++] != ' ') {
+				printf("MANIFEST: Invalid header\n");
+				return CELIX_FILE_IO_EXCEPTION;
+			}
+			name[0] = '\0';
+			strncpy(name, lbuf, i - 2);
+			name[i - 2] = '\0';
+			if (fpeek(file) == ' ') {
+				int newlen = len - i;
+				lastLine[0] = '\0';
+				strncpy(lastLine, lbuf+i, len -i);
+				lastLine[newlen] = '\0';
+				continue;
+			}
+			value[0] = '\0';
+			strncpy(value, lbuf+i, len - i);
+			value[len - i] = '\0';
+		}
+
+		properties_set(properties, name, value);
+	}
+
+	return CELIX_SUCCESS;
+}
+

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/manifest_parser.c
----------------------------------------------------------------------
diff --git a/framework/src/manifest_parser.c b/framework/src/manifest_parser.c
new file mode 100644
index 0000000..07b40a8
--- /dev/null
+++ b/framework/src/manifest_parser.c
@@ -0,0 +1,490 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * manifest_parser.c
+ *
+ *  \date       Jul 12, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <string.h>
+
+#include "utils.h"
+#include "constants.h"
+#include "manifest_parser.h"
+#include "capability.h"
+#include "requirement.h"
+#include "attribute.h"
+#include "hash_map.h"
+#include "celix_errno.h"
+#include "linked_list_iterator.h"
+#include "celix_log.h"
+
+//FIXME the manifest parser has no destroy function and as result contains memory leaks.
+
+struct manifestParser {
+	module_pt owner;
+	manifest_pt manifest;
+
+	version_pt bundleVersion;
+	char * bundleSymbolicName;
+	linked_list_pt capabilities;
+	linked_list_pt requirements;
+};
+
+static linked_list_pt manifestParser_parseImportHeader(const char* header);
+static linked_list_pt manifestParser_parseExportHeader(module_pt module, const char* header);
+static linked_list_pt manifestParser_parseDelimitedString(const char* value, const char* delim);
+static linked_list_pt manifestParser_parseStandardHeaderClause(const char* clauseString);
+static linked_list_pt manifestParser_parseStandardHeader(const char* header);
+
+celix_status_t manifestParser_create(module_pt owner, manifest_pt manifest, manifest_parser_pt *manifest_parser) {
+	celix_status_t status;
+	manifest_parser_pt parser;
+
+	status = CELIX_SUCCESS;
+	parser = (manifest_parser_pt) malloc(sizeof(*parser));
+	if (parser) {
+		const char * bundleVersion = NULL;
+		const char * bundleSymbolicName = NULL;
+		parser->manifest = manifest;
+		parser->owner = owner;
+
+		bundleVersion = manifest_getValue(manifest, OSGI_FRAMEWORK_BUNDLE_VERSION);
+		if (bundleVersion != NULL) {
+			parser->bundleVersion = NULL;
+			version_createVersionFromString(bundleVersion, &parser->bundleVersion);
+		} else {
+			parser->bundleVersion = NULL;
+			version_createEmptyVersion(&parser->bundleVersion);
+		}
+		bundleSymbolicName = manifest_getValue(manifest, OSGI_FRAMEWORK_BUNDLE_SYMBOLICNAME);
+		if (bundleSymbolicName != NULL) {
+			parser->bundleSymbolicName = (char*)bundleSymbolicName;
+		}
+
+		parser->capabilities = manifestParser_parseExportHeader(owner, manifest_getValue(manifest, OSGI_FRAMEWORK_EXPORT_LIBRARY));
+		parser->requirements = manifestParser_parseImportHeader(manifest_getValue(manifest, OSGI_FRAMEWORK_IMPORT_LIBRARY));
+
+		*manifest_parser = parser;
+
+		status = CELIX_SUCCESS;
+	} else {
+		status = CELIX_ENOMEM;
+	}
+
+	framework_logIfError(logger, status, NULL, "Cannot create manifest parser");
+
+	return status;
+}
+
+celix_status_t manifestParser_destroy(manifest_parser_pt mp) {
+	linkedList_destroy(mp->capabilities);
+	mp->capabilities = NULL;
+	linkedList_destroy(mp->requirements);
+	mp->requirements = NULL;
+	mp->bundleSymbolicName = NULL;
+	version_destroy(mp->bundleVersion);
+	mp->bundleVersion = NULL;
+	mp->manifest = NULL;
+	mp->owner = NULL;
+
+	free(mp);
+
+	return CELIX_SUCCESS;
+}
+
+static linked_list_pt manifestParser_parseDelimitedString(const char * value, const char * delim) {
+	linked_list_pt list;
+
+	if (linkedList_create(&list) == CELIX_SUCCESS) {
+		if (value != NULL) {
+			int CHAR = 1;
+			int DELIMITER = 2;
+			int STARTQUOTE = 4;
+			int ENDQUOTE = 8;
+
+			char buffer[512];
+			int expecting = (CHAR | DELIMITER | STARTQUOTE);
+			unsigned int i;
+
+			buffer[0] = '\0';
+
+			for (i = 0; i < strlen(value); i++) {
+				char c = value[i];
+
+				bool isDelimiter = (strchr(delim, c) != NULL);
+				bool isQuote = (c == '"');
+
+				if (isDelimiter && ((expecting & DELIMITER) > 0)) {
+					linkedList_addElement(list, strdup(buffer));
+					buffer[0] = '\0';
+					expecting = (CHAR | DELIMITER | STARTQUOTE);
+				} else if (isQuote && ((expecting & STARTQUOTE) > 0)) {
+					char tmp[2];
+					tmp[0] = c;
+					tmp[1] = '\0';
+					strcat(buffer, tmp);
+					expecting = CHAR | ENDQUOTE;
+				} else if (isQuote && ((expecting & ENDQUOTE) > 0)) {
+					char tmp[2];
+					tmp[0] = c;
+					tmp[1] = '\0';
+					strcat(buffer, tmp);
+					expecting = (CHAR | STARTQUOTE | DELIMITER);
+				} else if ((expecting & CHAR) > 0) {
+					char tmp[2];
+					tmp[0] = c;
+					tmp[1] = '\0';
+					strcat(buffer, tmp);
+				} else {
+					linkedList_destroy(list);
+					return NULL;
+				}
+			}
+
+			if (strlen(buffer) > 0) {
+				linkedList_addElement(list, strdup(utils_stringTrim(buffer)));
+			}
+		}
+	}
+
+	return list;
+}
+
+static linked_list_pt manifestParser_parseStandardHeaderClause(const char * clauseString) {
+	linked_list_pt paths = NULL;
+	linked_list_pt clause = NULL;
+	linked_list_pt pieces = NULL;
+
+	if(linkedList_create(&paths) != CELIX_SUCCESS){
+		return NULL;
+	}
+
+	pieces = manifestParser_parseDelimitedString(clauseString, ";");
+
+	if (pieces != NULL) {
+		int pathCount = 0;
+		int pieceIdx;
+		hash_map_pt dirsMap = NULL;
+		hash_map_pt attrsMap = NULL;
+		char * sep;
+
+		for (pieceIdx = 0; pieceIdx < linkedList_size(pieces); pieceIdx++) {
+			char * piece = linkedList_get(pieces, pieceIdx);
+			if (strchr(piece, '=') != NULL) {
+				break;
+			} else {
+				linkedList_addElement(paths, strdup(piece));
+				pathCount++;
+			}
+		}
+
+		if (pathCount != 0) {
+
+			dirsMap = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+			attrsMap = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+
+			bool failure = false;
+			char *key = NULL;
+			char *value = NULL;
+
+			for (pieceIdx = pathCount; pieceIdx < linkedList_size(pieces) && !failure ; pieceIdx++) {
+				char * sepPtr;
+				char * DIRECTIVE_SEP = ":=";
+				char * ATTRIBUTE_SEP = "=";
+				char * piece = linkedList_get(pieces, pieceIdx);
+				if ((sepPtr = strstr(piece, DIRECTIVE_SEP)) != NULL) {
+					sep = DIRECTIVE_SEP;
+				} else if ((sepPtr = strstr(piece, ATTRIBUTE_SEP)) != NULL) {
+					sep = ATTRIBUTE_SEP;
+				} else {
+					failure=true;
+					break;
+				}
+
+				if (strcmp(sep, DIRECTIVE_SEP) == 0) {
+					// Not implemented
+				}
+				else {
+
+					key = string_ndup(piece, sepPtr - piece);
+					value = strdup(sepPtr+strlen(sep));
+
+					if (value[0] == '"' && value[strlen(value) -1] == '"') {
+						char * oldV = strdup(value);
+						int len = strlen(oldV) - 2;
+						value = (char *) realloc(value, (sizeof(char) * len+1));
+						value[0] = '\0';
+						value = strncpy(value, oldV+1, strlen(oldV) - 2);
+						value[len] = '\0';
+						//check if correct
+						free(oldV);
+					}
+
+					attribute_pt attr = NULL;
+					if (hashMap_containsKey(attrsMap, key)) {
+						failure=true;
+						break;
+					}
+
+					if (attribute_create(key, value, &attr) == CELIX_SUCCESS) {
+						hashMap_put(attrsMap, key, attr);
+					}
+				}
+			}
+
+			if(linkedList_create(&clause) != CELIX_SUCCESS){
+				failure=true;
+			}
+
+			if(failure){
+				hashMap_destroy(dirsMap,false,false);
+
+				hash_map_iterator_pt attrIter = hashMapIterator_create(attrsMap);
+				while(hashMapIterator_hasNext(attrIter)){
+					hash_map_entry_pt entry = hashMapIterator_nextEntry(attrIter);
+					char *mkey = (char*)hashMapEntry_getKey(entry);
+					attribute_pt mattr = (attribute_pt)hashMapEntry_getValue(entry);
+					free(mkey);
+					attribute_destroy(mattr);
+				}
+				hashMapIterator_destroy(attrIter);
+				hashMap_destroy(attrsMap,false,false);
+
+				if(key!=NULL){
+					free(key);
+				}
+				if(value!=NULL){
+					free(value);
+				}
+
+				linked_list_iterator_pt piter = linkedListIterator_create(paths,0);
+				while(linkedListIterator_hasNext(piter)){
+					free(linkedListIterator_next(piter));
+				}
+				linkedListIterator_destroy(piter);
+				linkedList_destroy(paths);
+
+				if(clause!=NULL){
+					linkedList_destroy(clause);
+					clause = NULL;
+				}
+			}
+			else{
+				linkedList_addElement(clause, paths);
+				linkedList_addElement(clause, dirsMap);
+				linkedList_addElement(clause, attrsMap);
+			}
+
+		}
+		else{
+			linkedList_destroy(paths);
+		}
+
+		for(int listIdx = 0; listIdx < linkedList_size(pieces); listIdx++){
+			void * element = linkedList_get(pieces, listIdx);
+			free(element);
+		}
+		linkedList_destroy(pieces);
+	}
+	else{
+		linkedList_destroy(paths);
+	}
+
+	return clause;
+}
+
+static linked_list_pt manifestParser_parseStandardHeader(const char * header) {
+	linked_list_pt clauseStrings = NULL;
+	linked_list_pt completeList = NULL;
+
+	if(header != NULL && strlen(header)==0){
+		return NULL;
+	}
+
+	if (linkedList_create(&completeList) == CELIX_SUCCESS) {
+		if(header!=NULL){
+			char *hdr = strdup(header);
+			clauseStrings = manifestParser_parseDelimitedString(hdr, ",");
+			free(hdr);
+			if (clauseStrings != NULL) {
+				int i;
+				for (i = 0; i < linkedList_size(clauseStrings); i++) {
+					char *clauseString = (char *) linkedList_get(clauseStrings, i);
+					linkedList_addElement(completeList, manifestParser_parseStandardHeaderClause(clauseString));
+					free(clauseString);
+				}
+				linkedList_destroy(clauseStrings);
+			}
+		}
+
+	}
+
+	return completeList;
+}
+
+static linked_list_pt manifestParser_parseImportHeader(const char * header) {
+	linked_list_pt clauses = NULL;
+	linked_list_pt requirements = NULL;
+	bool failure = false;
+
+	int clauseIdx;
+	linked_list_iterator_pt iter;
+	clauses = manifestParser_parseStandardHeader(header);
+	linkedList_create(&requirements);
+
+	for (clauseIdx = 0; clauseIdx < linkedList_size(clauses) && !failure ; clauseIdx++) {
+		linked_list_pt clause = linkedList_get(clauses, clauseIdx);
+
+		linked_list_pt paths = linkedList_get(clause, 0);
+		hash_map_pt directives = linkedList_get(clause, 1);
+		hash_map_pt attributes = linkedList_get(clause, 2);
+
+		int pathIdx;
+		for (pathIdx = 0; pathIdx < linkedList_size(paths) && !failure ; pathIdx++) {
+			attribute_pt name = NULL;
+			requirement_pt req = NULL;
+			char * path = (char *) linkedList_get(paths, pathIdx);
+			if (strlen(path) == 0) {
+				failure = true;
+				break;
+			}
+
+			if (attribute_create(strdup("service"), path, &name) == CELIX_SUCCESS) {
+				char *key = NULL;
+				attribute_getKey(name, &key);
+				hashMap_put(attributes, key, name);
+			}
+
+			requirement_create(directives, attributes, &req);
+			linkedList_addElement(requirements, req);
+		}
+	}
+
+	if(!failure){
+		iter = linkedListIterator_create(clauses, 0);
+		while(linkedListIterator_hasNext(iter)) {
+			linked_list_pt clause = linkedListIterator_next(iter);
+
+			linked_list_pt paths = linkedList_get(clause, 0);
+			linkedList_destroy(paths);
+
+			linkedListIterator_remove(iter);
+			linkedList_destroy(clause);
+		}
+		linkedListIterator_destroy(iter);
+	}
+
+	linkedList_destroy(clauses);
+
+	if(failure){
+		linkedList_destroy(requirements);
+		requirements = NULL;
+	}
+
+	return requirements;
+}
+
+static linked_list_pt manifestParser_parseExportHeader(module_pt module, const char * header) {
+	linked_list_pt clauses = NULL;
+	linked_list_pt capabilities = NULL;
+	int clauseIdx;
+	linked_list_iterator_pt iter;
+	bool failure = false;
+
+	clauses = manifestParser_parseStandardHeader(header);
+	linkedList_create(&capabilities);
+
+	for (clauseIdx = 0; clauseIdx < linkedList_size(clauses) && !failure ; clauseIdx++) {
+		linked_list_pt clause = linkedList_get(clauses, clauseIdx);
+
+		linked_list_pt paths = linkedList_get(clause, 0);
+		hash_map_pt directives = linkedList_get(clause, 1);
+		hash_map_pt attributes = linkedList_get(clause, 2);
+
+		int pathIdx;
+		for (pathIdx = 0; pathIdx < linkedList_size(paths) && !failure ; pathIdx++) {
+			char * path = (char *) linkedList_get(paths, pathIdx);
+			attribute_pt name = NULL;
+			capability_pt cap = NULL;
+			if (strlen(path) == 0) {
+				failure=true;
+				break;
+			}
+
+			if (attribute_create(strdup("service"), path, &name) == CELIX_SUCCESS) {
+				char *key = NULL;
+				attribute_getKey(name, &key);
+				hashMap_put(attributes, key, name);
+			}
+
+			capability_create(module, directives, attributes, &cap);
+			linkedList_addElement(capabilities, cap);
+		}
+	}
+
+	if(!failure){
+		iter = linkedListIterator_create(clauses, 0);
+		while(linkedListIterator_hasNext(iter)) {
+			linked_list_pt clause = linkedListIterator_next(iter);
+
+			linked_list_pt paths = linkedList_get(clause, 0);
+			linkedList_destroy(paths);
+
+			linkedListIterator_remove(iter);
+			linkedList_destroy(clause);
+		}
+		linkedListIterator_destroy(iter);
+	}
+
+	linkedList_destroy(clauses);
+	if(failure){
+		linkedList_destroy(capabilities);
+		capabilities = NULL;
+	}
+
+	return capabilities;
+}
+
+celix_status_t manifestParser_getAndDuplicateSymbolicName(manifest_parser_pt parser, char **symbolicName) {
+	*symbolicName = strndup(parser->bundleSymbolicName, 1024*10);
+	return CELIX_SUCCESS;
+}
+
+celix_status_t manifestParser_getBundleVersion(manifest_parser_pt parser, version_pt *version) {
+	return version_clone(parser->bundleVersion, version);
+}
+
+celix_status_t manifestParser_getCapabilities(manifest_parser_pt parser, linked_list_pt *capabilities) {
+	celix_status_t status;
+
+	status = linkedList_clone(parser->capabilities, capabilities);
+
+	return status;
+}
+
+celix_status_t manifestParser_getRequirements(manifest_parser_pt parser, linked_list_pt *requirements) {
+	celix_status_t status;
+
+	status = linkedList_clone(parser->requirements, requirements);
+
+	return status;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/manifest_parser.h
----------------------------------------------------------------------
diff --git a/framework/src/manifest_parser.h b/framework/src/manifest_parser.h
new file mode 100644
index 0000000..d6b062b
--- /dev/null
+++ b/framework/src/manifest_parser.h
@@ -0,0 +1,45 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * manifest_parser.h
+ *
+ *  \date       Jul 13, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+#ifndef MANIFEST_PARSER_H_
+#define MANIFEST_PARSER_H_
+
+#include "module.h"
+#include "version.h"
+#include "manifest.h"
+#include "linked_list.h"
+
+typedef struct manifestParser * manifest_parser_pt;
+
+celix_status_t manifestParser_create(module_pt owner, manifest_pt manifest, manifest_parser_pt *manifest_parser);
+celix_status_t manifestParser_destroy(manifest_parser_pt mp);
+
+celix_status_t manifestParser_getAndDuplicateSymbolicName(manifest_parser_pt parser, char **symbolicName);
+celix_status_t manifestParser_getBundleVersion(manifest_parser_pt parser, version_pt *version);
+celix_status_t manifestParser_getCapabilities(manifest_parser_pt parser, linked_list_pt *capabilities);
+celix_status_t manifestParser_getRequirements(manifest_parser_pt parser, linked_list_pt *requirements);
+
+#endif /* MANIFEST_PARSER_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/miniunz.c
----------------------------------------------------------------------
diff --git a/framework/src/miniunz.c b/framework/src/miniunz.c
new file mode 100644
index 0000000..c3a9bd1
--- /dev/null
+++ b/framework/src/miniunz.c
@@ -0,0 +1,382 @@
+/*
+   miniunz.c
+   Version 1.1, February 14h, 2010
+   sample part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+         Modifications of Unzip for Zip64
+         Copyright (C) 2007-2008 Even Rouault
+
+         Modifications for Zip64 support on both zip and unzip
+         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+*/
+
+#ifndef _WIN32
+        #ifndef __USE_FILE_OFFSET64
+                #define __USE_FILE_OFFSET64
+        #endif
+        #ifndef __USE_LARGEFILE64
+                #define __USE_LARGEFILE64
+        #endif
+        #ifndef _LARGEFILE64_SOURCE
+                #define _LARGEFILE64_SOURCE
+        #endif
+        #ifndef _FILE_OFFSET_BIT
+                #define _FILE_OFFSET_BIT 64
+        #endif
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#ifdef _WIN32
+#include <sys/utime.h>
+#else
+#include <utime.h>
+#endif
+#include <sys/stat.h>
+
+#include "unzip.h"
+#include "archive.h"
+
+#define CASESENSITIVITY (0)
+#define WRITEBUFFERSIZE (8192)
+#define MAXFILENAME (256)
+
+#ifdef _WIN32
+#define USEWIN32IOAPI
+#include "iowin32.h"
+#include <direct.h>
+#endif
+/*
+  mini unzip, demo of unzip package
+
+  usage :
+  Usage : miniunz [-exvlo] file.zip [file_to_extract] [-d extractdir]
+
+  list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT
+    if it exists
+*/
+
+
+/* change_file_date : change the date/time of a file
+    filename : the filename of the file where date/time must be modified
+    dosdate : the new date at the MSDos format (4 bytes)
+    tmu_date : the SAME new date at the tm_unz format */
+void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date)
+{
+#ifdef _WIN32
+  HANDLE hFile;
+  FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
+
+  hFile = CreateFileA(filename,GENERIC_READ | GENERIC_WRITE,
+                      0,NULL,OPEN_EXISTING,0,NULL);
+  GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite);
+  DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal);
+  LocalFileTimeToFileTime(&ftLocal,&ftm);
+  SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
+  CloseHandle(hFile);
+#else
+#if defined(unix) || defined(__APPLE__)
+  struct utimbuf ut;
+  struct tm newdate;
+  newdate.tm_sec = tmu_date.tm_sec;
+  newdate.tm_min=tmu_date.tm_min;
+  newdate.tm_hour=tmu_date.tm_hour;
+  newdate.tm_mday=tmu_date.tm_mday;
+  newdate.tm_mon=tmu_date.tm_mon;
+  if (tmu_date.tm_year > 1900)
+      newdate.tm_year=tmu_date.tm_year - 1900;
+  else
+      newdate.tm_year=tmu_date.tm_year ;
+  newdate.tm_isdst=-1;
+
+  ut.actime=ut.modtime=mktime(&newdate);
+  utime(filename,&ut);
+#endif
+#endif
+}
+
+
+/* mymkdir and change_file_date are not 100 % portable
+   As I don't know well Unix, I wait feedback for the unix portion */
+
+int mymkdir(const char *dirname)
+{
+    int ret=0;
+#ifdef _WIN32
+    ret = _mkdir(dirname);
+#else
+#if defined unix || defined __APPLE__
+    ret = mkdir(dirname,0775);
+#endif
+#endif
+    return ret;
+}
+
+int makedir (char *newdir)
+{
+  char *buffer ;
+  char *p;
+  int  len = (int)strlen(newdir);
+
+  if (len <= 0)
+    return 0;
+
+  buffer = (char*)malloc(len+1);
+        if (buffer==NULL)
+        {
+                printf("Error allocating memory\n");
+                return UNZ_INTERNALERROR;
+        }
+  strcpy(buffer,newdir);
+
+  if (buffer[len-1] == '/') {
+    buffer[len-1] = '\0';
+  }
+  if (mymkdir(buffer) == 0)
+    {
+      free(buffer);
+      return 1;
+    }
+
+  p = buffer+1;
+  while (1)
+    {
+      char hold;
+
+      while(*p && *p != '\\' && *p != '/')
+        p++;
+      hold = *p;
+      *p = 0;
+      if ((mymkdir(buffer) == -1) && (errno == ENOENT))
+        {
+          printf("couldn't create directory %s\n",buffer);
+          free(buffer);
+          return 0;
+        }
+      if (hold == 0)
+        break;
+      *p++ = hold;
+    }
+  free(buffer);
+  return 1;
+}
+
+int do_extract_currentfile(unzFile uf, char * revisionRoot) {
+    char filename_inzip[256];
+    char* filename_withoutpath;
+    char* p;
+    int err=UNZ_OK;
+    FILE *fout=NULL;
+    void* buf;
+    uInt size_buf;
+
+    unz_file_info64 file_info;
+    err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
+
+    if (err!=UNZ_OK)
+    {
+        printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
+        return err;
+    }
+
+    size_buf = WRITEBUFFERSIZE;
+    buf = (void*)malloc(size_buf);
+    if (buf==NULL)
+    {
+        printf("Error allocating memory\n");
+        return UNZ_INTERNALERROR;
+    }
+
+    p = filename_withoutpath = filename_inzip;
+    while ((*p) != '\0')
+    {
+        if (((*p)=='/') || ((*p)=='\\'))
+            filename_withoutpath = p+1;
+        p++;
+    }
+
+    if ((*filename_withoutpath)=='\0') {
+		char * dir;
+		dir = (char *)malloc(strlen(revisionRoot) + strlen(filename_inzip) + 2);
+		strcpy(dir, revisionRoot);
+		strcat(dir, "/");
+		strcat(dir, filename_inzip);
+		mymkdir(dir);
+		free(dir);
+    }
+    else
+    {
+        const char* write_filename;
+        int skip=0;
+		int length;
+		char * fWFN;
+        write_filename = filename_inzip;
+
+        length = strlen(write_filename) + strlen(revisionRoot) + 2;
+        fWFN = (char *)malloc(length);
+        strcpy(fWFN, revisionRoot);
+        strcat(fWFN, "/");
+        strcat(fWFN, write_filename);
+
+        err = unzOpenCurrentFile(uf);
+        if (err!=UNZ_OK)
+        {
+            printf("error %d with zipfile in unzOpenCurrentFilePassword\n",err);
+        }
+
+        if ((skip==0) && (err==UNZ_OK))
+        {
+            fout=fopen64(fWFN,"wb");
+
+            /* some zipfile don't contain directory alone before file */
+            if ((fout==NULL) && (filename_withoutpath!=(char*)filename_inzip))
+            {
+				char * dir;
+				int length;
+                char c=*(filename_withoutpath-1);
+                *(filename_withoutpath-1)='\0';
+                length = strlen(write_filename) + strlen(revisionRoot) + 2;
+                dir = (char *)malloc(length);
+				strcpy(dir, revisionRoot);
+				strcat(dir, "/");
+				strcat(dir, write_filename);
+                makedir(dir);
+                *(filename_withoutpath-1)=c;
+				free(dir);
+                fout=fopen64(fWFN,"wb");
+            }
+
+            if (fout==NULL)
+            {
+                printf("error opening %s\n",write_filename);
+            }
+        }
+
+        if (fout!=NULL)
+        {
+            do
+            {
+                err = unzReadCurrentFile(uf,buf,size_buf);
+                if (err<0)
+                {
+                    printf("error %d with zipfile in unzReadCurrentFile\n",err);
+                    break;
+                }
+                if (err>0)
+                    if (fwrite(buf,err,1,fout)!=1)
+                    {
+                        printf("error in writing extracted file\n");
+                        err=UNZ_ERRNO;
+                        break;
+                    }
+            }
+            while (err>0);
+            if (fout)
+                    fclose(fout);
+
+            if (err==0)
+                change_file_date(fWFN,file_info.dosDate,
+                                 file_info.tmu_date);
+        }
+
+        if (err==UNZ_OK)
+        {
+            err = unzCloseCurrentFile (uf);
+            if (err!=UNZ_OK)
+            {
+                printf("error %d with zipfile in unzCloseCurrentFile\n",err);
+            }
+        }
+        else
+            unzCloseCurrentFile(uf); /* don't lose the error */
+
+		free(fWFN);
+    }
+
+    free(buf);
+    return err;
+}
+
+
+int do_extract(unzFile uf, char * revisionRoot) {
+    uLong i;
+    unz_global_info64 gi;
+    int err;
+
+    err = unzGetGlobalInfo64(uf,&gi);
+    if (err!=UNZ_OK)
+        printf("error %d with zipfile in unzGetGlobalInfo \n",err);
+
+    for (i=0;i<gi.number_entry;i++)
+    {
+        if (do_extract_currentfile(uf, revisionRoot) != UNZ_OK)
+            break;
+
+        if ((i+1)<gi.number_entry)
+        {
+            err = unzGoToNextFile(uf);
+            if (err!=UNZ_OK)
+            {
+                printf("error %d with zipfile in unzGoToNextFile\n",err);
+                break;
+            }
+        }
+    }
+
+    return 0;
+}
+
+celix_status_t extractBundle(const char* bundleName, const char* revisionRoot) {
+    celix_status_t status = CELIX_SUCCESS;
+    char filename_try[MAXFILENAME+16] = "";
+    unzFile uf=NULL;
+
+    if (bundleName!=NULL)
+    {
+
+#        ifdef USEWIN32IOAPI
+        zlib_filefunc64_def ffunc;
+#        endif
+
+        strncpy(filename_try, bundleName,MAXFILENAME-1);
+        /* strncpy doesnt append the trailing NULL, of the string is too long. */
+        filename_try[ MAXFILENAME ] = '\0';
+
+#        ifdef USEWIN32IOAPI
+        fill_win32_filefunc64A(&ffunc);
+        uf = unzOpen2_64(bundleName,&ffunc);
+#        else
+        uf = unzOpen64(bundleName);
+#        endif
+        if (uf==NULL)
+        {
+            strcat(filename_try,".zip");
+#            ifdef USEWIN32IOAPI
+            uf = unzOpen2_64(filename_try,&ffunc);
+#            else
+            uf = unzOpen64(filename_try);
+#            endif
+        }
+    }
+
+    if (uf==NULL)
+    {
+        printf("Cannot open %s or %s.zip\n",bundleName,bundleName);
+        status = CELIX_FILE_IO_EXCEPTION;
+    } else {
+        if (do_extract(uf, (char*)revisionRoot) != 0) {
+            status = CELIX_FILE_IO_EXCEPTION;
+        }
+
+        unzClose(uf);
+    }
+
+    return status;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/module.c
----------------------------------------------------------------------
diff --git a/framework/src/module.c b/framework/src/module.c
new file mode 100644
index 0000000..e81a1ee
--- /dev/null
+++ b/framework/src/module.c
@@ -0,0 +1,281 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * module.c
+ *
+ *  \date       Jul 19, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "module.h"
+#include "manifest_parser.h"
+#include "linked_list_iterator.h"
+
+struct module {
+	linked_list_pt capabilities;
+	linked_list_pt requirements;
+	linked_list_pt wires;
+
+	array_list_pt dependentImporters;
+
+	version_pt version;
+	char * symbolicName;
+	bool resolved;
+
+	manifest_pt headerMap;
+	char * id;
+
+	struct bundle * bundle;
+};
+
+module_pt module_create(manifest_pt headerMap, const char * moduleId, bundle_pt bundle) {
+    module_pt module = NULL;
+    manifest_parser_pt mp;
+
+    if (headerMap != NULL) {
+        module = (module_pt) malloc(sizeof(*module));
+        module->headerMap = headerMap;
+        module->id = strdup(moduleId);
+        module->bundle = bundle;
+        module->resolved = false;
+
+        module->dependentImporters = NULL;
+        arrayList_create(&module->dependentImporters);
+
+        if (manifestParser_create(module, headerMap, &mp) == CELIX_SUCCESS) {
+            module->symbolicName = NULL;
+            manifestParser_getAndDuplicateSymbolicName(mp, &module->symbolicName);
+
+            module->version = NULL;
+            manifestParser_getBundleVersion(mp, &module->version);
+
+            module->capabilities = NULL;
+            manifestParser_getCapabilities(mp, &module->capabilities);
+
+            module->requirements = NULL;
+            manifestParser_getRequirements(mp, &module->requirements);
+
+            module->wires = NULL;
+
+            manifestParser_destroy(mp);
+        }
+    }
+
+    return module;
+}
+
+module_pt module_createFrameworkModule(bundle_pt bundle) {
+    module_pt module;
+
+	module = (module_pt) malloc(sizeof(*module));
+	if (module) {
+        module->id = strdup("0");
+        module->symbolicName = strdup("framework");
+        module->version = NULL;
+        version_createVersion(1, 0, 0, "", &module->version);
+
+        linkedList_create(&module->capabilities);
+        linkedList_create(&module->requirements);
+        module->dependentImporters = NULL;
+        arrayList_create(&module->dependentImporters);
+        module->wires = NULL;
+        module->headerMap = NULL;
+        module->resolved = false;
+        module->bundle = bundle;
+	}
+	return module;
+}
+
+void module_destroy(module_pt module) {
+	arrayList_destroy(module->dependentImporters);
+
+	version_destroy(module->version);
+
+	if (module->wires != NULL) {
+        linked_list_iterator_pt iter = linkedListIterator_create(module->wires, 0);
+        while (linkedListIterator_hasNext(iter)) {
+            wire_pt next = linkedListIterator_next(iter);
+            linkedListIterator_remove(iter);
+            wire_destroy(next);
+        }
+        linkedListIterator_destroy(iter);
+        linkedList_destroy(module->wires);
+	}
+
+	if (module->requirements != NULL) {
+	    linked_list_iterator_pt iter = linkedListIterator_create(module->requirements, 0);
+        while (linkedListIterator_hasNext(iter)) {
+            requirement_pt next = linkedListIterator_next(iter);
+            linkedListIterator_remove(iter);
+            requirement_destroy(next);
+        }
+        linkedListIterator_destroy(iter);
+        linkedList_destroy(module->requirements);
+	}
+
+	if (module->capabilities != NULL) {
+	    linked_list_iterator_pt iter = linkedListIterator_create(module->capabilities, 0);
+        while (linkedListIterator_hasNext(iter)) {
+            capability_pt next = linkedListIterator_next(iter);
+            linkedListIterator_remove(iter);
+            capability_destroy(next);
+        }
+        linkedListIterator_destroy(iter);
+        linkedList_destroy(module->capabilities);
+    }
+
+	module->headerMap = NULL;
+
+	free(module->id);
+	free(module->symbolicName);
+	free(module);
+}
+
+wire_pt module_getWire(module_pt module, const char * serviceName) {
+	wire_pt wire = NULL;
+	if (module->wires != NULL) {
+		linked_list_iterator_pt iterator = linkedListIterator_create(module->wires, 0);
+		while (linkedListIterator_hasNext(iterator)) {
+			const char* name;
+			wire_pt next = linkedListIterator_next(iterator);
+			capability_pt cap = NULL;
+			wire_getCapability(next, &cap);
+			capability_getServiceName(cap, &name);
+			if (strcasecmp(name, serviceName) == 0) {
+				wire = next;
+			}
+		}
+		linkedListIterator_destroy(iterator);
+	}
+	return wire;
+}
+
+version_pt module_getVersion(module_pt module) {
+	return module->version;
+}
+
+celix_status_t module_getSymbolicName(module_pt module, const char **symbolicName) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (module == NULL) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	} else {
+		*symbolicName = module->symbolicName;
+	}
+
+	return status;
+}
+
+char * module_getId(module_pt module) {
+	return module->id;
+}
+
+linked_list_pt module_getWires(module_pt module) {
+	return module->wires;
+}
+
+void module_setWires(module_pt module, linked_list_pt wires) {
+    int i = 0;
+    for (i = 0; (module->wires != NULL) && (i < linkedList_size(module->wires)); i++) {
+        wire_pt wire = (wire_pt) linkedList_get(module->wires, i);
+        module_pt exporter = NULL;
+        wire_getExporter(wire, &exporter);
+        module_removeDependentImporter(exporter, module);
+    }
+
+    if (module->wires != NULL) {
+		linked_list_iterator_pt iter = linkedListIterator_create(module->wires, 0);
+		while (linkedListIterator_hasNext(iter)) {
+			wire_pt next = linkedListIterator_next(iter);
+			linkedListIterator_remove(iter);
+			wire_destroy(next);
+		}
+		linkedListIterator_destroy(iter);
+		linkedList_destroy(module->wires);
+	}
+
+	module->wires = wires;
+
+	for (i = 0; (module->wires != NULL) && (i < linkedList_size(module->wires)); i++) {
+        wire_pt wire = (wire_pt) linkedList_get(module->wires, i);
+        module_pt exporter = NULL;
+        wire_getExporter(wire, &exporter);
+        module_addDependentImporter(exporter, module);
+    }
+}
+
+bool module_isResolved(module_pt module) {
+	return module->resolved;
+}
+
+void module_setResolved(module_pt module) {
+	module->resolved = true;
+}
+
+bundle_pt module_getBundle(module_pt module) {
+	return module->bundle;
+}
+
+linked_list_pt module_getRequirements(module_pt module) {
+	return module->requirements;
+}
+
+linked_list_pt module_getCapabilities(module_pt module) {
+	return module->capabilities;
+}
+
+array_list_pt module_getDependentImporters(module_pt module) {
+    return module->dependentImporters;
+}
+
+void module_addDependentImporter(module_pt module, module_pt importer) {
+    if (!arrayList_contains(module->dependentImporters, importer)) {
+        arrayList_add(module->dependentImporters, importer);
+    }
+}
+
+void module_removeDependentImporter(module_pt module, module_pt importer) {
+    arrayList_removeElement(module->dependentImporters, importer);
+}
+
+//----------------------------------------------------
+//TODO add implementation (functions not implemented but already exported)
+array_list_pt module_getDependentRequirers(module_pt module) {
+	return NULL;
+}
+
+void module_addDependentRequirer(module_pt module, module_pt requirer) {
+}
+
+void module_removeDependentRequirer(module_pt module, module_pt requirer) {
+}
+//----------------------------------------------------
+
+array_list_pt module_getDependents(module_pt module) {
+    array_list_pt dependents = NULL;
+    arrayList_create(&dependents);
+
+    arrayList_addAll(dependents, module->dependentImporters);
+
+    return dependents;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/registry_callback_private.h
----------------------------------------------------------------------
diff --git a/framework/src/registry_callback_private.h b/framework/src/registry_callback_private.h
new file mode 100644
index 0000000..146a1d1
--- /dev/null
+++ b/framework/src/registry_callback_private.h
@@ -0,0 +1,42 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * service_reference_private.h
+ *
+ *  \date       Nov 16, 2015
+ *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
+ */
+
+
+#ifndef REGISTRY_CALLBACK_H_
+#define REGISTRY_CALLBACK_H_
+
+#include "celix_errno.h"
+#include "service_reference.h"
+#include "service_registration.h"
+
+typedef struct registry_callback_struct {
+	void *handle;
+    celix_status_t (*getUsingBundles)(void *handle, service_registration_pt reg, array_list_pt *bundles);
+	celix_status_t (*unregister)(void *handle, bundle_pt bundle, service_registration_pt reg);
+	celix_status_t (*modified)(void *handle, service_registration_pt registration, properties_pt oldProperties);
+} registry_callback_t;
+
+#endif /* REGISTRY_CALLBACK_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/requirement.c
----------------------------------------------------------------------
diff --git a/framework/src/requirement.c b/framework/src/requirement.c
new file mode 100644
index 0000000..7ce585c
--- /dev/null
+++ b/framework/src/requirement.c
@@ -0,0 +1,114 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * requirement.c
+ *
+ *  \date       Jul 12, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+#include <stdlib.h>
+
+#include "requirement_private.h"
+#include "version_range.h"
+#include "attribute.h"
+#include "celix_log.h"
+
+celix_status_t requirement_create(hash_map_pt directives, hash_map_pt attributes, requirement_pt *requirement) {
+	celix_status_t status;
+
+	*requirement = (requirement_pt) malloc(sizeof(**requirement));
+	if (!*requirement) {
+		status = CELIX_ENOMEM;
+	} else {
+		attribute_pt serviceAttribute = NULL;
+		attribute_pt versionAttribute = NULL;
+
+		(*requirement)->attributes = attributes;
+		(*requirement)->directives = directives;
+		(*requirement)->versionRange = NULL;
+
+		serviceAttribute = (attribute_pt) hashMap_get(attributes, "service");
+		status = attribute_getValue(serviceAttribute, &(*requirement)->targetName);
+		if (status == CELIX_SUCCESS) {
+			versionAttribute = (attribute_pt) hashMap_get(attributes, "version");
+			if (versionAttribute != NULL) {
+				char *versionStr = NULL;
+				attribute_getValue(versionAttribute, &versionStr);
+				status = versionRange_parse(versionStr, &(*requirement)->versionRange);
+			} else {
+				status = versionRange_createInfiniteVersionRange(&(*requirement)->versionRange);
+			}
+		}
+	}
+
+	framework_logIfError(logger, status, NULL, "Cannot create requirement");
+
+	return status;
+}
+
+celix_status_t requirement_destroy(requirement_pt requirement) {
+	hash_map_iterator_pt attrIter = hashMapIterator_create(requirement->attributes);
+	while (hashMapIterator_hasNext(attrIter)) {
+		attribute_pt attr = hashMapIterator_nextValue(attrIter);
+		hashMapIterator_remove(attrIter);
+		attribute_destroy(attr);
+	}
+	hashMapIterator_destroy(attrIter);
+	hashMap_destroy(requirement->attributes, false, false);
+	hashMap_destroy(requirement->directives, false, false);
+
+	requirement->attributes = NULL;
+	requirement->directives = NULL;
+
+	versionRange_destroy(requirement->versionRange);
+	requirement->versionRange = NULL;
+
+	free(requirement);
+
+	return CELIX_SUCCESS;
+}
+
+celix_status_t requirement_getVersionRange(requirement_pt requirement, version_range_pt *range) {
+	*range = requirement->versionRange;
+	return CELIX_SUCCESS;
+}
+
+celix_status_t requirement_getTargetName(requirement_pt requirement, const char **targetName) {
+	*targetName = requirement->targetName;
+	return CELIX_SUCCESS;
+}
+
+celix_status_t requirement_isSatisfied(requirement_pt requirement, capability_pt capability, bool *inRange) {
+	celix_status_t status;
+	version_pt version = NULL;
+	version_range_pt range = NULL;
+
+	status = capability_getVersion(capability, &version);
+	if (status == CELIX_SUCCESS) {
+		status = requirement_getVersionRange(requirement, &range);
+		if (status == CELIX_SUCCESS) {
+			status = versionRange_isInRange(range, version, inRange);
+		}
+	}
+
+	framework_logIfError(logger, status, NULL, "Cannot check if requirement is satisfied");
+
+	return status;
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/src/requirement_private.h
----------------------------------------------------------------------
diff --git a/framework/src/requirement_private.h b/framework/src/requirement_private.h
new file mode 100644
index 0000000..7510110
--- /dev/null
+++ b/framework/src/requirement_private.h
@@ -0,0 +1,40 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * requirement_private.h
+ *
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
+ */
+
+
+#ifndef REQUIREMENT_PRIVATE_H_
+#define REQUIREMENT_PRIVATE_H_
+
+#include "requirement.h"
+
+struct requirement {
+	char * targetName;
+	version_range_pt versionRange;
+	hash_map_pt attributes;
+	hash_map_pt directives;
+};
+
+#endif /* REQUIREMENT_PRIVATE_H_ */