OSSP CVS Repository

ossp - Check-in [4405]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4405
Date: 2004-Feb-11 15:38:40 (local)
2004-Feb-11 14:38:40 (UTC)
User:rse
Branch:
Comment: Added an experimental additional DCE 1.1 API for backward compatibility with existing applications.
Tickets:
Inspections:
Files:
ossp-pkg/uuid/ChangeLog      1.35 -> 1.36     5 inserted, 1 deleted
ossp-pkg/uuid/Makefile.in      1.17 -> 1.18     31 inserted, 1 deleted
ossp-pkg/uuid/uuid.ac      1.9 -> 1.10     13 inserted, 0 deleted
ossp-pkg/uuid/uuid_dce.c      added-> 1.1
ossp-pkg/uuid/uuid_dce.h      added-> 1.1

ossp-pkg/uuid/ChangeLog 1.35 -> 1.36

--- ChangeLog    2004/02/06 08:51:36     1.35
+++ ChangeLog    2004/02/11 14:38:40     1.36
@@ -11,7 +11,11 @@
   This is a list of all changes to OSSP uuid.
   For a more brief summary please have a look at the NEWS file.
 
-  Changes between 0.9.4 and 0.9.5 (19-Jan-2004 to 06-Feb-2004)
+  Changes between 0.9.4 and 0.9.5 (19-Jan-2004 to 11-Feb-2004)
+
+   o Added an experimental additional DCE 1.1 API for backward
+     compatibility with existing applications.
+     [Ralf S. Engelschall]
 
    o Fixed filedescriptor leak in the PRNG sub-API.
      [Guerry Semones <guerry@tsunamiresearch.com>]


ossp-pkg/uuid/Makefile.in 1.17 -> 1.18

--- Makefile.in  2004/01/19 14:11:49     1.17
+++ Makefile.in  2004/02/11 14:38:40     1.18
@@ -53,15 +53,22 @@
 LIB_NAME    = libuuid.la
 LIB_OBJS    = uuid.lo uuid_md5.lo uuid_prng.lo uuid_mac.lo uuid_ui64.lo uuid_str.lo
 
+DCE_NAME    = libuuid_dce.la
+DCE_OBJS    = $(LIB_OBJS) uuid_dce.lo
+
 PRG_NAME    = uuid
 PRG_OBJS    = uuid_cli.o
 
 MAN_NAME    = uuid.3 uuid.1
 
+TARGETS     = $(LIB_NAME) @DCE_NAME@ $(PRG_NAME)
+
+WITH_DCE    = @WITH_DCE@
+
 .SUFFIXES:
 .SUFFIXES: .c .o .lo
 
-all: $(LIB_NAME) $(PRG_NAME)
+all: $(TARGETS)
 
 .c.o:
         $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
@@ -73,6 +80,10 @@
         @$(LIBTOOL) --mode=link $(CC) -o $(LIB_NAME) $(LIB_OBJS) -rpath $(libdir) \
             -version-info `$(SHTOOL) version -l txt -d libtool VERSION`
 
+$(DCE_NAME): $(DCE_OBJS)
+        @$(LIBTOOL) --mode=link $(CC) -o $(DCE_NAME) $(DCE_OBJS) -rpath $(libdir) \
+            -version-info `$(SHTOOL) version -l txt -d libtool VERSION`
+
 $(PRG_NAME): $(PRG_OBJS) $(LIB_NAME)
         @$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $(PRG_NAME) $(PRG_OBJS) $(LIB_NAME) $(LIBS)
 
@@ -82,6 +93,7 @@
 uuid_prng.lo: uuid_prng.c uuid_prng.h
 uuid_str.lo: uuid_str.c config.h uuid_str.h
 uuid_ui64.lo: uuid_ui64.c uuid_ui64.h
+uuid_dce.lo: uuid_dce.c uuid.h uuid_dce.h
 uuid_cli.o: uuid_cli.c uuid.h
 
 man: uuid.3 uuid-config.1 uuid.1
@@ -141,8 +153,15 @@
         $(SHTOOL) install -c -m 755 uuid-config $(DESTDIR)$(bindir)/
         $(SHTOOL) install -c -m 644 uuid-config.1 $(DESTDIR)$(mandir)/man1/
         $(SHTOOL) install -c -m 644 uuid.h $(DESTDIR)$(includedir)/
+        -@if [ ".$(WITH_DCE)" = .yes ]; then \
+            echo "$(SHTOOL) install -c -m 644 uuid_dce.h $(DESTDIR)$(includedir)/"; \
+            $(SHTOOL) install -c -m 644 uuid_dce.h $(DESTDIR)$(includedir)/; \
+        fi
         $(SHTOOL) install -c -m 644 uuid.3 $(DESTDIR)$(mandir)/man3/
         @$(LIBTOOL) --mode=install $(SHTOOL) install -c -m 644 libuuid.la $(DESTDIR)$(libdir)/
+        -@if [ ".$(WITH_DCE)" = .yes ]; then \
+            $(LIBTOOL) --mode=install $(SHTOOL) install -c -m 644 libuuid_dce.la $(DESTDIR)$(libdir)/; \
+        fi
         @$(LIBTOOL) --mode=install $(SHTOOL) install -c -s -m 755 uuid $(DESTDIR)$(bindir)/
         $(SHTOOL) install -c -m 644 uuid.1 $(DESTDIR)$(mandir)/man1/
 
@@ -150,8 +169,15 @@
         -$(RM) $(DESTDIR)$(mandir)/man1/uuid.1
         -@$(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(bindir)/uuid
         -@$(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(libdir)/libuuid.la
+        -@if [ ".$(WITH_DCE)" = .yes ]; then \
+            $(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(libdir)/libuuid_dce.la; \
+        fi
         -$(RM) $(DESTDIR)$(mandir)/man3/uuid.3
         -$(RM) $(DESTDIR)$(includedir)/uuid.h
+        -@if [ ".$(WITH_DCE)" = .yes ]; then \
+            echo "$(RM) $(DESTDIR)$(includedir)/uuid_dce.h"; \
+            $(RM) $(DESTDIR)$(includedir)/uuid_dce.h; \
+        fi
         -$(RM) $(DESTDIR)$(mandir)/man1/uuid-config.1
         -$(RM) $(DESTDIR)$(bindir)/uuid-config
         -$(RMDIR) $(DESTDIR)$(mandir)/man1 >/dev/null 2>&1 || $(TRUE)
@@ -164,6 +190,10 @@
 
 clean:
         -$(RM) $(LIB_NAME) $(LIB_OBJS)
+        -@if [ ".$(WITH_DCE)" = .yes ]; then \
+            echo "$(RM) $(DCE_NAME) $(DCE_OBJS)"; \
+            $(RM) $(DCE_NAME) $(DCE_OBJS); \
+        fi
         -$(RM) $(PRG_NAME) $(PRG_OBJS)
         -$(RM) -r .libs >/dev/null 2>&1 || $(TRUE)
         -$(RM) *.o *.lo


ossp-pkg/uuid/uuid.ac 1.9 -> 1.10

--- uuid.ac      2004/01/16 15:35:37     1.9
+++ uuid.ac      2004/02/11 14:38:40     1.10
@@ -77,5 +77,18 @@
     if test ".$ac_cv_with_rfc2518" = ".yes"; then
         AC_DEFINE(WITH_RFC2518, 1, [whether to use incorrect generation of IEEE 802 multicast addresses according to RFC2518])
     fi
+    AC_ARG_WITH(dce,
+        AC_HELP_STRING([--with-dce], [build DCE 1.1 backward compatibility API]),
+        [ac_cv_with_dce=$withval], [ac_cv_with_dce=no])
+    if test ".$ac_cv_with_dce" = ".yes"; then
+        AC_DEFINE(WITH_DCE, 1, [whether to build DCE 1.1 backward compatibility API])
+        WITH_DCE='yes'
+        DCE_NAME='$(DCE_NAME)'
+    else
+        WITH_DCE='no'
+        DCE_NAME=''
+    fi
+    AC_SUBST(WITH_DCE)
+    AC_SUBST(DCE_NAME)
 ])
 


ossp-pkg/uuid/uuid_dce.c -> 1.1

*** /dev/null    Tue Apr 30 16:00:55 2024
--- -    Tue Apr 30 16:02:45 2024
***************
*** 0 ****
--- 1,291 ----
+ /*
+ **  OSSP uuid - Universally Unique Identifier
+ **  Copyright (c) 2004 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2004 The OSSP Project <http://www.ossp.org/>
+ **
+ **  This file is part of OSSP uuid, a library for the generation
+ **  of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  uuid_dce.c: DCE 1.1 compatibility API implementation
+ */
+ 
+ /* include DCE 1.1 API */
+ #define uuid_t uuid_dce_t
+ #include "uuid_dce.h"
+ #undef uuid_t
+ #undef uuid_create
+ #undef uuid_create_nil
+ #undef uuid_is_nil
+ #undef uuid_compare
+ #undef uuid_equal
+ #undef uuid_from_string
+ #undef uuid_to_string
+ #undef uuid_hash
+ 
+ /* include regular API */
+ #include "uuid.h"
+ 
+ /* create a UUID (v1 only) */
+ void uuid_dce_create(uuid_dce_t *uuid_dce, int *status)
+ {
+     uuid_t *uuid;
+     size_t len;
+     void *vp;
+ 
+     /* initialize status */
+     if (status != NULL)
+         *status = uuid_s_error;
+ 
+     /* sanity check argument(s) */
+     if (uuid_dce == NULL)
+         return;
+ 
+     /* create UUID and export as binary representation */
+     if (uuid_create(&uuid) != UUID_RC_OK)
+         return;
+     if (uuid_make(uuid, UUID_MAKE_V1) != UUID_RC_OK) {
+         uuid_destroy(uuid);
+         return;
+     }
+     vp  = uuid_dce;
+     len = UUID_LEN_BIN;
+     if (uuid_export(uuid, UUID_FMT_BIN, &vp, &len) != UUID_RC_OK) {
+         uuid_destroy(uuid);
+         return;
+     }
+     uuid_destroy(uuid);
+ 
+     /* return successfully */
+     if (status != NULL)
+         *status = uuid_s_ok;
+     return;
+ }
+ 
+ /* create a Nil UUID */
+ void uuid_dce_create_nil(uuid_dce_t *uuid_dce, int *status)
+ {
+     /* initialize status */
+     if (status != NULL)
+         *status = uuid_s_error;
+ 
+     /* sanity check argument(s) */
+     if (uuid_dce == NULL)
+         return;
+ 
+     /* short-circuit implementation, because Nil UUID is trivial to
+        create, so no need to use regular OSSP uuid API */
+     memset(uuid_dce, '\0', UUID_LEN_BIN);
+ 
+     /* return successfully */
+     if (status != NULL)
+         *status = uuid_s_ok;
+     return;
+ }
+ 
+ /* check whether it is Nil UUID */
+ int uuid_dce_is_nil(uuid_dce_t *uuid_dce, int *status)
+ {
+     int i;
+     int result;
+     unsigned char *ucp;
+ 
+     /* initialize status */
+     if (status != NULL)
+         *status = uuid_s_error;
+ 
+     /* sanity check argument(s) */
+     if (uuid_dce == NULL)
+         return 0;
+ 
+     /* short-circuit implementation, because Nil UUID is trivial to
+        check, so no need to use regular OSSP uuid API */
+     result = 1;
+     ucp = (unsigned char *)uuid_dce;
+     for (i = 0; i < UUID_LEN_BIN; i++) {
+         if (ucp[i] != '\0') {
+             result = 0;
+             break;
+         }
+     }
+ 
+     /* return successfully with result */
+     if (status != NULL)
+         *status = uuid_s_ok;
+     return result;
+ }
+ 
+ /* compare two UUIDs */
+ int uuid_dce_compare(uuid_dce_t *uuid_dce1, uuid_dce_t *uuid_dce2, int *status)
+ {
+     uuid_t *uuid1 = NULL;
+     uuid_t *uuid2 = NULL;
+     int result = 0;
+ 
+     /* initialize status */
+     if (status != NULL)
+         *status = uuid_s_error;
+ 
+     /* sanity check argument(s) */
+     if (uuid_dce1 == NULL || uuid_dce2 == NULL)
+         return 0;
+ 
+     /* import both UUID binary representations and compare them */
+     if (uuid_create(&uuid1) != UUID_RC_OK)
+         goto leave;
+     if (uuid_create(&uuid2) != UUID_RC_OK)
+         goto leave;
+     if (uuid_import(uuid1, UUID_FMT_BIN, uuid_dce1, UUID_LEN_BIN) != UUID_RC_OK)
+         goto leave;
+     if (uuid_import(uuid2, UUID_FMT_BIN, uuid_dce2, UUID_LEN_BIN) != UUID_RC_OK)
+         goto leave;
+     if (uuid_compare(uuid1, uuid2, &result) != UUID_RC_OK)
+         goto leave;
+ 
+     /* indicate successful operation */
+     if (status != NULL)
+         *status = uuid_s_ok;
+ 
+     /* cleanup and return */
+     leave:
+     if (uuid1 != NULL)
+         uuid_destroy(uuid1);
+     if (uuid2 != NULL)
+         uuid_destroy(uuid2);
+     return result;
+ }
+ 
+ /* compare two UUIDs (equality only) */
+ int uuid_dce_equal(uuid_dce_t *uuid_dce1, uuid_dce_t *uuid_dce2, int *status)
+ {
+     /* initialize status */
+     if (status != NULL)
+         *status = uuid_s_error;
+ 
+     /* sanity check argument(s) */
+     if (uuid_dce1 == NULL || uuid_dce2 == NULL)
+         return 0;
+ 
+     /* pass through to generic compare function */
+     return (uuid_dce_compare(uuid_dce1, uuid_dce2, status) == 0 ? 1 : 0);
+ }
+ 
+ /* import UUID from string representation */
+ void uuid_dce_from_string(const char *str, uuid_dce_t *uuid_dce, int *status)
+ {
+     uuid_t *uuid = NULL;
+     size_t len;
+     void *vp;
+ 
+     /* initialize status */
+     if (status != NULL)
+         *status = uuid_s_error;
+ 
+     /* sanity check argument(s) */
+     if (str == NULL || uuid_dce == NULL)
+         return;
+ 
+     /* import string representation and export binary representation */
+     if (uuid_create(&uuid) != UUID_RC_OK)
+         goto leave;
+     if (uuid_import(uuid, UUID_FMT_STR, str, UUID_LEN_STR) != UUID_RC_OK)
+         goto leave;
+     vp  = uuid_dce;
+     len = UUID_LEN_BIN;
+     if (uuid_export(uuid, UUID_FMT_BIN, &vp, &len) != UUID_RC_OK)
+         goto leave;
+ 
+     /* indicate successful operation */
+     if (status != NULL)
+         *status = uuid_s_ok;
+ 
+     /* cleanup and return */
+     leave:
+     if (uuid != NULL)
+         uuid_destroy(uuid);
+     return;
+ }
+ 
+ /* export UUID to string representation */
+ void uuid_dce_to_string(uuid_dce_t *uuid_dce, char **str, int *status)
+ {
+     uuid_t *uuid = NULL;
+     size_t len;
+     void *vp;
+ 
+     /* initialize status */
+     if (status != NULL)
+         *status = uuid_s_error;
+ 
+     /* sanity check argument(s) */
+     if (str == NULL || uuid_dce == NULL)
+         return;
+ 
+     /* import binary representation and export string representation */
+     if (uuid_create(&uuid) != UUID_RC_OK)
+         goto leave;
+     if (uuid_import(uuid, UUID_FMT_BIN, uuid_dce, UUID_LEN_BIN) != UUID_RC_OK)
+         goto leave;
+     vp  = str;
+     len = UUID_LEN_STR;
+     if (uuid_export(uuid, UUID_FMT_STR, &vp, &len) != UUID_RC_OK)
+         goto leave;
+ 
+     /* indicate successful operation */
+     if (status != NULL)
+         *status = uuid_s_ok;
+ 
+     /* cleanup and return */
+     leave:
+     if (uuid != NULL)
+         uuid_destroy(uuid);
+     return;
+ }
+ 
+ /* export UUID into hash value */
+ unsigned int uuid_dce_hash(uuid_dce_t *uuid_dce, int *status)
+ {
+     int i;
+     unsigned char *ucp;
+     unsigned int hash;
+ 
+     /* initialize status */
+     if (status != NULL)
+         *status = uuid_s_error;
+ 
+     /* sanity check argument(s) */
+     if (uuid_dce == NULL)
+         return 0;
+ 
+     /* generate a hash value
+        (DCE 1.1 actually requires 16-bit only) */
+     hash = 0;
+     ucp = (unsigned char *)uuid_dce;
+     for (i = UUID_LEN_BIN-1; i >= 0; i--) {
+         hash <<= 8;
+         hash |= ucp[i];
+     }
+ 
+     /* return successfully */
+     if (status != NULL)
+         *status = uuid_s_ok;
+     return hash;
+ }
+ 


ossp-pkg/uuid/uuid_dce.h -> 1.1

*** /dev/null    Tue Apr 30 16:00:55 2024
--- -    Tue Apr 30 16:02:45 2024
***************
*** 0 ****
--- 1,88 ----
+ /*
+ **  OSSP uuid - Universally Unique Identifier
+ **  Copyright (c) 2004 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2004 The OSSP Project <http://www.ossp.org/>
+ **
+ **  This file is part of OSSP uuid, a library for the generation
+ **  of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  uuid_dce.h: DCE 1.1 compatibility API definition
+ */
+ 
+ #ifndef __UUID_DCE_H___
+ #define __UUID_DCE_H___
+ 
+ /* sanity check usage */
+ #ifdef __UUID_H__
+ #error the regular OSSP uuid API and the DCE 1.1 backward compatibility API are mutually exclusive -- you cannot use them at the same time.
+ #endif
+ 
+ /* resolve namespace conflicts (at linking level) with regular OSSP uuid API */
+ #define uuid_create      uuid_dce_create
+ #define uuid_create_nil  uuid_dce_create_nil
+ #define uuid_is_nil      uuid_dce_is_nil
+ #define uuid_compare     uuid_dce_compare
+ #define uuid_equal       uuid_dce_equal
+ #define uuid_from_string uuid_dce_from_string
+ #define uuid_to_string   uuid_dce_to_string
+ #define uuid_hash        uuid_dce_hash
+ 
+ /* DCE 1.1 uuid_t type */
+ typedef struct {
+ #if 0
+     /* stricter but unportable version */
+     uuid_uint32_t   time_low;
+     uuid_uint16_t   time_mid;
+     uuid_uint16_t   time_hi_and_version;
+     uuid_uint8_t    clock_seq_hi_and_reserved;
+     uuid_uint8_t    clock_seq_low;
+     uuid_uint8_t    node[6];
+ #else
+     /* sufficient and portable version */
+     unsigned char   data[16];
+ #endif
+ } uuid_t;
+ typedef uuid_t *uuid_p_t;
+ 
+ /* DCE 1.1 uuid_vector_t type */
+ typedef struct {
+     unsigned int    count;
+     uuid_t         *uuid[1];
+ } uuid_vector_t;
+ 
+ /* DCE 1.1 UUID API status codes */
+ enum {
+     uuid_s_ok = 0,     /* standardized */
+     uuid_s_error = 1   /* implementation specific */
+ };
+ 
+ /* DCE 1.1 UUID API functions */
+ extern void          uuid_create      (uuid_t *,               int *);
+ extern void          uuid_create_nil  (uuid_t *,               int *);
+ extern int           uuid_is_nil      (uuid_t *,               int *);
+ extern int           uuid_compare     (uuid_t *, uuid_t *,     int *);
+ extern int           uuid_equal       (uuid_t *, uuid_t *,     int *);
+ extern void          uuid_from_string (const char *, uuid_t *, int *);
+ extern void          uuid_to_string   (uuid_t *,     char **,  int *);
+ extern unsigned int  uuid_hash        (uuid_t *,               int *);
+ 
+ #endif /* __UUID_DCE_H___ */
+ 

CVSTrac 2.0.1