提交 7ad60948 authored 作者: Michael Jerris's avatar Michael Jerris

remove libuuid from tree

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16072 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 4809a944
......@@ -215,12 +215,10 @@ CORE_CFLAGS += -I$(switch_srcdir)/libs/pcre
CORE_CFLAGS += -I$(switch_srcdir)/libs/speex/include -Ilibs/speex/include
CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/include
CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include
CORE_CFLAGS += -I$(switch_builddir)/libs/uuid
CORE_CFLAGS += -I$(switch_srcdir)/libs/uuid
CORE_LIBS = libs/apr-util/libaprutil-1.la libs/apr/libapr-1.la
CORE_LIBS += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la libs/speex/libspeex/libspeexdsp.la
CORE_LIBS += libs/srtp/libsrtp.la libs/uuid/libuuid.la
CORE_LIBS += libs/srtp/libsrtp.la
lib_LTLIBRARIES = libfreeswitch.la
libfreeswitch_la_CFLAGS = $(CORE_CFLAGS) $(AM_CFLAGS)
......@@ -370,18 +368,6 @@ nodepends: .nodepends
yesdepends:
rm .nodepends
libs/uuid/configure:
test -f $@ || $(MAKE) uuid-reconf
@$(TOUCH_TARGET)
libs/uuid/Makefile: libs/uuid/configure
test -f $@ || cd $(top_builddir)/libs/uuid && $(SHELL) ./config.status Makefile
@$(TOUCH_TARGET)
libs/uuid/libuuid.la: libs/uuid libs/uuid/.update libs/uuid/Makefile
@cd libs/uuid && $(MAKE)
@$(TOUCH_TARGET)
libs/apr/libapr-1.la: libs/apr libs/apr/.update
@cd libs/apr && $(MAKE)
@$(TOUCH_TARGET)
......@@ -494,12 +480,6 @@ iks-reconf:
cd libs/iksemel && sh ./configure.gnu --prefix=$(PREFIX)
$(MAKE) mod_dingaling-clean
uuid-reconf:
cd libs/uuid && $(MAKE) clean || echo
cd libs/uuid && autoreconf -fi
cd libs/uuid && sh ./configure.gnu --prefix=$(PREFIX)
cd libs/uuid && $(MAKE)
spandsp-reconf:
cd libs/spandsp && $(MAKE) clean || echo
cd libs/spandsp && autoreconf -fi
......
Tue Dec 22 14:12:35 EST 2009
_ ___ ____ ____ ____ _ _
|_|_ _ / _ \/ ___/ ___|| _ \ _ _ _ _(_) __| |
_|_||_| | | | \___ \___ \| |_) | | | | | | | | |/ _` |
|_||_|_| | |_| |___) |__) | __/ | |_| | |_| | | (_| |
|_|_|_| \___/|____/____/|_| \__,_|\__,_|_|\__,_|
OSSP uuid - Universally Unique Identifier
AUTHORS
This is a list of authors who have written
or edited major parts of the OSSP uuid sources.
Ralf S. Engelschall <rse@engelschall.com>
_ ___ ____ ____ ____ _ _
|_|_ _ / _ \/ ___/ ___|| _ \ _ _ _ _(_) __| |
_|_||_| | | | \___ \___ \| |_) | | | | | | | | |/ _` |
|_||_|_| | |_| |___) |__) | __/ | |_| | |_| | | (_| |
|_|_|_| \___/|____/____/|_| \__,_|\__,_|_|\__,_|
OSSP uuid - Universally Unique Identifier
LANGUAGE BINDINGS
Various programming language bindings exist for OSSP uuid.
The following is the list of known bindings:
o C
(native API)
o C++
(addon API; part of the OSSP uuid distribution; see uuid++.* files)
o Perl
(addon API; part of the OSSP uuid distribution; see perl/ directory)
o PHP
(addon API; part of the OSSP uuid distribution; see php/ directory)
o PostgreSQL
(addon API; part of the OSSP uuid distribution; see pgsql/ directory)
o GNU Guile GEE (Scheme)
https://gna.org/projects/gee
o Chicken (Scheme)
http://www.call-with-current-continuation.org/eggs/uuid-ossp.html
差异被折叠。
差异被折叠。
_ ___ ____ ____ ____ _ _
|_|_ _ / _ \/ ___/ ___|| _ \ _ _ _ _(_) __| |
_|_||_| | | | \___ \___ \| |_) | | | | | | | | |/ _` |
|_||_|_| | |_| |___) |__) | __/ | |_| | |_| | | (_| |
|_|_|_| \___/|____/____/|_| \__,_|\__,_|_|\__,_|
OSSP uuid - Universally Unique Identifier
INSTALLATION
To install OSSP uuid into /path/to/uuid/ perform
the following steps in your shell:
$ ./configure
--prefix=/path/to/uuid
[--with-dce]
[--with-perl[=/path/to/[bin[/perl]
--with-perl-compat]]
[--with-php]
$ make
$ make check
$ make install [DESTDIR=/path/to/temp/root]
AUTHORS
BINDINGS
ChangeLog
HISTORY
INSTALL
MANIFEST
Makefile.PL
Makefile.in
NEWS
OVERVIEW
PORTING
README
SEEALSO
THANKS
TODO
USERS
aclocal.m4
config.guess
config.h.in
config.sub
configure
configure.ac
libtool.m4
ltmain.sh
perl/MANIFEST
perl/Makefile.PL
perl/uuid.pm
perl/uuid.pod
perl/uuid.tm
perl/uuid.ts
perl/uuid.xs
perl/uuid_compat.pm
perl/uuid_compat.pod
perl/uuid_compat.ts
pgsql/Makefile
pgsql/uuid.c
pgsql/uuid.sql.in
pgsql/uuid.txt
php/Makefile.local
php/config.m4
php/package.xml
php/uuid.c
php/uuid.php4
php/uuid.php5
php/uuid.ts
shtool
uuid++.3
uuid++.cc
uuid++.hh
uuid++.pod
uuid-config.1
uuid-config.in
uuid-config.pod
uuid.1
uuid.3
uuid.ac
uuid.c
uuid.h.in
uuid.pc.in
uuid.pod
uuid_ac.h
uuid_bm.h
uuid_cli.c
uuid_cli.pod
uuid_dce.c
uuid_dce.h
uuid_mac.c
uuid_mac.h
uuid_md5.c
uuid_md5.h
uuid_prng.c
uuid_prng.h
uuid_sha1.c
uuid_sha1.h
uuid_str.c
uuid_str.h
uuid_time.c
uuid_time.h
uuid_ui128.c
uuid_ui128.h
uuid_ui64.c
uuid_ui64.h
uuid_vers.h
##
## OSSP uuid - Universally Unique Identifier
## Copyright (c) 2004-2008 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2004-2008 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.
##
## Makefile.PL: top-level Perl ExtUtils::MakeMaker wrapper script
##
require 5.008;
use IO::File;
my $ARGS = join(" ", @ARGV);
print "++ writing Makefile\n";
my $mk = new IO::File ">Makefile" or die;
$mk->print(<< "EOF");
PERL = $^X
FULLPERL = $^X
ARGS = $ARGS
all pure_all:
\@if [ ! -d build ]; then mkdir build; fi
\@if [ ! -f build/Makefile ]; then (cd build && ../configure --disable-shared); fi
\@if [ ! -f build/libuuid.la ]; then (cd build && \$(MAKE) \$(MFLAGS) libuuid.la); fi
\@if [ ! -f perl/Makefile ]; then (cd perl && \$(PERL) Makefile.PL \$(ARGS)); fi
\@cd perl && \$(MAKE) \$(MFLAGS) \$\@
install pure_install test:
\@cd perl && \$(MAKE) \$(MFLAGS) \$\@
clean:
\@cd build && \$(MAKE) \$(MFLAGS) \$\@
\@cd perl && \$(MAKE) \$(MFLAGS) \$\@
distclean realclean:
\@cd build && \$(MAKE) \$(MFLAGS) \$\@
\@cd perl && \$(MAKE) \$(MFLAGS) \$\@
-rm -rf build || true
-rm -rf Makefile || true
EOF
$mk->close();
差异被折叠。
_ ___ ____ ____ ____ _ _
|_|_ _ / _ \/ ___/ ___|| _ \ _ _ _ _(_) __| |
_|_||_| | | | \___ \___ \| |_) | | | | | | | | |/ _` |
|_||_|_| | |_| |___) |__) | __/ | |_| | |_| | | (_| |
|_|_|_| \___/|____/____/|_| \__,_|\__,_|_|\__,_|
OSSP uuid - Universally Unique Identifier
NEWS
This is a list of major changes to OSSP uuid. For more detailed
change descriptions, please have a look at the ChangeLog file.
Major changes between 1.4 and 1.5
o Many internal code cleanups and fixes.
o Improved and fixed PostgreSQL API.
o Improved and fixed PHP API.
Major changes between 1.3 and 1.4
o Added PostgreSQL API.
Major changes between 1.2 and 1.3
o Added Perl TIE-style API.
o Added Perl Data::UUID backward compatibility API.
o Added C++ API.
o Added PHP API.
Major changes between 1.1 and 1.2
o Added support for version 5 UUIDs (name-based, SHA-1)
Major changes between 1.0 and 1.1
o Added Perl API
Major changes between 0.9 and 1.0
o Initial functionality
_ ___ ____ ____ ____ _ _
|_|_ _ / _ \/ ___/ ___|| _ \ _ _ _ _(_) __| |
_|_||_| | | | \___ \___ \| |_) | | | | | | | | |/ _` |
|_||_|_| | |_| |___) |__) | __/ | |_| | |_| | | (_| |
|_|_|_| \___/|____/____/|_| \__,_|\__,_|_|\__,_|
OSSP uuid - Universally Unique Identifier
OVERVIEW
A UUID consists of 128 bits (16-octets) which are split into 6
octet-bounded unsigned integer fields ("time_low", "time_mid",
"time_hi_and_version", "clk_seq_hi_res", "clk_seq_low" and "node") and
where two fields are multiplexed with a fixed size 4-bit "version" and
a variable sized 2-3 bit "variant" field.
The UUID octets are counted from left to right 15 to 0 and the bits
in each octet are counted from left to right 7 to 0 (most significant
bit first, least significant bit last). The unsigned integer fields
formed out of multiple octets are stored in "network byte order" (most
significant octet first, least significant octet last). A UUID is
stored and transmitted from left to right, i.e., in "network byte
order" with the most significant octet first and the least significant
octet last.
Illustration 1:
(single octet array, less compact, more annotations)
Bits: [4] [2-3]
Field: version variant
MSO -->| |<-- -->| |<-- LSO
\ | | | | /
Octet: 15 14 13 12 11 10 | |9 8 | | 7 6 5 4 3 2 1 0
+------++------++------++------++------++------++------++------++------++------++------++------++------++------++------++------+
UUID: | || || || || || |#### || |##: || || || || || || || |
+------++------++------++------++------++------++------++------++------++------++------++------++------++------++------++------+
Bit: 76543210765432107654321076543210765432107654321076543210765432107654321076543210765432107654321076543210765432107654321076543210
/| || || || || || |\
MSB | || || || || || | LSB
|<---------------------------->||<------------>||<------------>||<---->||<---->||<-------------------------------------------->|
time_hi clk_seq clk_seq
Field: time_low time_mid _and_version _hi_res _low node
Bits: [32] [16] [16] [5-6] [8] [48]
Illustration 2:
(two octet arrays, more compact, less annotations)
[4]
version
-->| |<--
| |
| | [16]
[32] [16] | |time_hi
time_low time_mid | _and_version
|<---------------------------->||<------------>||<------------>|
| MSO || || | |
| / || || | |
| 15 14 13 12 || 11 10 || |9 8 |
7654321076543210765432107654321076543210765432107654321076543210
/+------++------++------++------++------++------++------++------+~
MSB | || || || || || |#### || | ...
+------++------++------++------++------++------++------++------+~
~+------++------++------++------++------++------++------++------+
... ##: || || || || || || || | LSB
~+------++------++------++------++------++------++------++------+/
7654321076543210765432107654321076543210765432107654321076543210
| | 7 || 6 || 5 4 3 2 1 0 |
| | || || / |
| | || || LSO |
|<---->||<---->||<-------------------------------------------->|
|clk_seq clk_seq node
|_hi_res _low [48]
|[5-6] [8]
| |
-->| |<--
variant
[2-3]
_ ___ ____ ____ ____ _ _
|_|_ _ / _ \/ ___/ ___|| _ \ _ _ _ _(_) __| |
_|_||_| | | | \___ \___ \| |_) | | | | | | | | |/ _` |
|_||_|_| | |_| |___) |__) | __/ | |_| | |_| | | (_| |
|_|_|_| \___/|____/____/|_| \__,_|\__,_|_|\__,_|
OSSP uuid - Universally Unique Identifier
PORTING
OSSP uuid was already written with maximum portability in mind, so
there should be no great effort required to get it running on any Unix
platform with a reasonable POSIX API. Additionally, the portability
was tested by successfully building and running it on the following
particular Unix platforms (syntax is "<cpu>-<os> (<compiler>)"):
alpha-tru644.0 (cc)
alpha-tru645.1 (gcc, cc)
hppa-hpux11.11 (cc)
ia64-hpux11.23 (cc)
ix86-debian2.2 (gcc, icc)
ix86-debian3.0 (gcc)
ix86-debian3.1 (gcc)
ix86-freebsd4.9 (gcc)
ix86-freebsd5.2 (gcc, icc)
ix86-netbsd1.6 (gcc)
ix86-qnx6.2 (gcc)
ix86-solaris10 (gcc)
ix86-unixware7.1.3 (cc)
mips64-irix6.5 (gcc)
sparc64-solaris8 (gcc, forte)
sparc64-solaris9 (gcc)
_ ___ ____ ____ ____ _ _
|_|_ _ / _ \/ ___/ ___|| _ \ _ _ _ _(_) __| |
_|_||_| | | | \___ \___ \| |_) | | | | | | | | |/ _` |
|_||_|_| | |_| |___) |__) | __/ | |_| | |_| | | (_| |
|_|_|_| \___/|____/____/|_| \__,_|\__,_|_|\__,_|
OSSP uuid - Universally Unique Identifier
Version 1.6.2 (04-Jul-2008)
ABSTRACT
OSSP uuid is a ISO-C:1999 application programming interface (API)
and corresponding command line interface (CLI) for the generation of
DCE 1.1, ISO/IEC 11578:1996 and IETF RFC-4122 compliant Universally
Unique Identifier (UUID). It supports DCE 1.1 variant UUIDs of version
1 (time and node based), version 3 (name based, MD5), version 4
(random number based) and version 5 (name based, SHA-1). Additional
API bindings are provided for the languages ISO-C++:1998, Perl:5 and
PHP:4/5. Optional backward compatibility exists for the ISO-C DCE-1.1
and Perl Data::UUID APIs.
UUIDs are 128 bit numbers which are intended to have a high likelihood
of uniqueness over space and time and are computationally difficult
to guess. They are globally unique identifiers which can be locally
generated without contacting a global registration authority. UUIDs
are intended as unique identifiers for both mass tagging objects
with an extremely short lifetime and to reliably identifying very
persistent objects across a network.
COPYRIGHT AND LICENSE
Copyright (c) 2004-2008 Ralf S. Engelschall <rse@engelschall.com>
Copyright (c) 2004-2008 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.
HOME AND DOCUMENTATION
The documentation and latest release can be found on
o http://www.ossp.org/pkg/lib/uuid/
o ftp://ftp.ossp.org/pkg/lib/uuid/
_ ___ ____ ____ ____ _ _
|_|_ _ / _ \/ ___/ ___|| _ \ _ _ _ _(_) __| |
_|_||_| | | | \___ \___ \| |_) | | | | | | | | |/ _` |
|_||_|_| | |_| |___) |__) | __/ | |_| | |_| | | (_| |
|_|_|_| \___/|____/____/|_| \__,_|\__,_|_|\__,_|
OSSP uuid - Universally Unique Identifier
SEE ALSO
Although we consider OSSP uuid the ultimate reference implementation
of an UUID generator, there are multiple alternatives available.
Following is a short reference of all currently known UUID
implementations for platforms with an Unix/POSIX API:
o OSSP uuid (ISO-C), OSSP::uuid (Perl)
http://www.ossp.org/pkg/lib/uuid/
http://cvs.ossp.org/ossp-pkg/uuid/
o FreeBSD libc (ISO-C)
http://www.freebsd.org/
http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/uuid/
o Sun Solaris libc (ISO-C), DCE::UUID (Perl/XS)
http://www.opensolaris.org/
http://cvs.opensolaris.org/source/xref/usr/src/lib/libuuid/
o APR libaprutil (ISO-C), APR::UUID (Perl/XS)
http://svn.apache.org/repos/asf/apr/apr-util/trunk/crypto/
o e2fsprogs/libuuid (ISO-C), UUID (Perl/XS)
http://e2fsprogs.sourceforge.net/
http://thunk.org/hg/e2fsprogs/
o Wine rpcrt4 DLL (ISO-C)
http://www.winehq.org/
o Data::UUID (Perl/XS)
http://search.cpan.org/src/AGOLOMSH/
http://www.cpan.org/modules/by-module/Data/
o JUG (Java/JNI)
http://www.doomdark.org/doomdark/proj/jug/
o Mozilla (ISO-C, ISO-C++)
http://www.mozilla.org/
http://lxr.mozilla.org/mozilla1.7/source/calendar/libxpical/token.c
o HelixPlayer (ISO-C, ISO-C++)
https://player.helixcommunity.org/
common/util/chxuuid.cpp
_ ___ ____ ____ ____ _ _
|_|_ _ / _ \/ ___/ ___|| _ \ _ _ _ _(_) __| |
_|_||_| | | | \___ \___ \| |_) | | | | | | | | |/ _` |
|_||_|_| | |_| |___) |__) | __/ | |_| | |_| | | (_| |
|_|_|_| \___/|____/____/|_| \__,_|\__,_|_|\__,_|
OSSP uuid - Universally Unique Identifier
THANKS
Credit has to be given to the following people who contributed ideas,
bugfixes, hints, gave platform feedback, etc. (in alphabetical order):
o Matthias Andree <matthias.andree@gmx.de>
o Neil Caunt <retardis@gmail.com>
o Neil Conway <neilc@samurai.com>
o M. Daniel <mdaniel@scdi.com>
o Simon "janus" Dassow <janus@errornet.de>
o Fuyuki <fuyuki@nigredo.org>
o Thomas Lotterer <thomas@lotterer.net>
o Roman Neuhauser <neuhauser@sigpipe.cz>
o Hrvoje Niksic <hniksic@xemacs.org>
o Piotr Roszatycki <dexter@debian.org>
o Hiroshi Saito <z-saito@guitar.ocn.ne.jp>
o Michael Schloh <michael@schloh.com>
o Guerry Semones <guerry@tsunamiresearch.com>
o David Wheeler <david@justatheory.com>
o Wu Yongwei <wuyongwei@gmail.com>
_ ___ ____ ____ ____ _ _
|_|_ _ / _ \/ ___/ ___|| _ \ _ _ _ _(_) __| |
_|_||_| | | | \___ \___ \| |_) | | | | | | | | |/ _` |
|_||_|_| | |_| |___) |__) | __/ | |_| | |_| | | (_| |
|_|_|_| \___/|____/____/|_| \__,_|\__,_|_|\__,_|
OSSP uuid - Universally Unique Identifier
TODO
====
- <none>
CANDO
=====
- allow to re-create version 1 UUIDs by specifying time, etc.
- getopt_long support for CLI?
- a more sophisticated test suite with UUID references?!
- more platform support in uuid_mac.c?!
- global memory locking according to standard hints??
- persistent/non-volatile state writing according to standard hints??
_ ___ ____ ____ ____ _ _
|_|_ _ / _ \/ ___/ ___|| _ \ _ _ _ _(_) __| |
_|_||_| | | | \___ \___ \| |_) | | | | | | | | |/ _` |
|_||_|_| | |_| |___) |__) | __/ | |_| | |_| | | (_| |
|_|_|_| \___/|____/____/|_| \__,_|\__,_|_|\__,_|
OSSP uuid - Universally Unique Identifier
USERS
OSSP uuid is known to be used by at least the following
Open Source software packages:
o PostgreSQL
Relational Database Management System (RDBMS)
http://www.postgresql.org/
o Aegis
Software Configuration Management (SCM) System
http://aegis.sourceforge.net/
o Heartbeat
Core component of the High-Availability Linux (Linux-HA) project
http://linux-ha.org/heartbeat/
o GAT
Grid Application Toolkit (GAT)
https://www.gridlab.org/WorkPackages/wp-1/
o Menes
High-Level C++ Library for mutexes, networking, etc.
http://www.saurik.com/
http://svn.saurik.com/repos/menes/trunk/
o OpenAether OAPR
C++ wrapper for NSPR
http://www.openaether.org/oapr.html
o Gauche Scheme Interpreter, UUID extension
http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/gauche/Gauche-uuid/
http://www.shiro.dreamhost.com/scheme/gauche/
o Guile Extension Examples (GEE)
https://gna.org/projects/gee
o CGI::Session::ID::uuid
UUID based ID generator backend for CGI::Session
http://www.cpan.org/modules/by-authors/id/RSE/
差异被折叠。
dnl ##
dnl ## OSSP uuid - Universally Unique Identifier
dnl ## Copyright (c) 2004-2008 Ralf S. Engelschall <rse@engelschall.com>
dnl ## Copyright (c) 2004-2008 The OSSP Project <http://www.ossp.org/>
dnl ##
dnl ## This file is part of OSSP uuid, a library for the generation
dnl ## of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
dnl ##
dnl ## Permission to use, copy, modify, and distribute this software for
dnl ## any purpose with or without fee is hereby granted, provided that
dnl ## the above copyright notice and this permission notice appear in all
dnl ## copies.
dnl ##
dnl ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
dnl ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
dnl ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
dnl ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
dnl ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
dnl ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
dnl ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
dnl ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
dnl ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
dnl ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
dnl ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
dnl ## SUCH DAMAGE.
dnl ##
dnl ## configure.ac: GNU Autoconf source script
dnl ##
AC_PREREQ(2.53)
AC_INIT
UUID_VERSION_RAW=`$ac_confdir/shtool version -l c -d short uuid_vers.h`
UUID_VERSION_STR=`$ac_confdir/shtool version -l c -d long uuid_vers.h`
UUID_VERSION_HEX=`$ac_confdir/shtool version -l c -d hex uuid_vers.h`
$ac_confdir/shtool echo -e \
"Configuring %BOSSP uuid%b (Universally Unique Identifier), version %B${UUID_VERSION_STR}%b"
AC_SUBST(UUID_VERSION_RAW)
AC_SUBST(UUID_VERSION_STR)
AC_SUBST(UUID_VERSION_HEX)
AC_PROG_MAKE_SET
AC_PROG_CC
AC_CHECK_DEBUGGING
AC_CHECK_DMALLOC
with_tags=""
sinclude(libtool.m4)
AC_PROG_LIBTOOL
sinclude(uuid.ac)
UUID_CHECK_ALL
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_FILES([Makefile uuid-config uuid.pc uuid.h])
AC_CONFIG_COMMANDS([adjustment], [chmod a-w uuid.h; chmod a+x uuid-config])
AC_OUTPUT
#! /bin/sh
srcpath=$(dirname $0 2>/dev/null ) || srcpath="."
$srcpath/configure "$@" --disable-shared --with-pic
MANIFEST
Makefile.PL
uuid.xs
uuid.tm
uuid.pm
uuid.pod
uuid.ts
uuid_compat.pm
uuid_compat.pod
uuid_compat.ts
##
## OSSP uuid - Universally Unique Identifier
## Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2004-2007 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.
##
## Makefile.PL: Perl MakeMaker build source procedure
##
require 5.008;
use Config;
use ExtUtils::MakeMaker;
# determine source directory
my ($srcdir) = map { my $d = $_; $d =~ s/\/libuuid\.la$//; $d }
grep { -f $_ } ("../libuuid.la", glob("../*/libuuid.la"))
or die "no source directory found (where libuuid.la is located)";
# determine extra build options
my $compat = 0;
@ARGV = grep { $_ =~ m/^COMPAT=(\d+)$/i ? ($compat = $1, 0) : 1 } @ARGV;
# generate Makefile
WriteMakefile(
NAME => 'OSSP::uuid',
VERSION_FROM => 'uuid.pm',
ABSTRACT_FROM => 'uuid.pod',
PREREQ_PM => {},
LIBS => [ "-L$srcdir/.libs -L$srcdir -luuid" ],
DEFINE => '',
INC => "-I. -I$srcdir",
PM => { 'uuid.pm' => '$(INST_LIBDIR)/uuid.pm',
'uuid.pod' => '$(INST_LIBDIR)/uuid.pod',
($compat ? ('uuid_compat.pm' => '$(INST_LIBDIR)/../Data/UUID.pm') : ()),
($compat ? ('uuid_compat.pod' => '$(INST_LIBDIR)/../Data/UUID.pod') : ()), },
MAN3PODS => { 'uuid.pod' => '$(INST_MAN3DIR)/OSSP::uuid.3',
($compat ? ('uuid_compat.pod' => '$(INST_MAN3DIR)/Data::UUID.3') : ()), },
TYPEMAPS => [ 'uuid.tm' ],
test => { TESTS => 'uuid.ts' . ($compat ? ' uuid_compat.ts' : '') },
NO_META => 1,
# cruel hack to workaround the conflict between OSSP uuid's
# uuid_create() function and one from FreeBSD's libc
(( "$Config{'osname'}$Config{'osvers'}" =~ m/^freebsd[56]\./
and $Config{'ld'} =~ m/cc$/ and -f "/usr/include/uuid.h") ?
( LDDLFLAGS => $Config{'lddlflags'} . ' -Wl,-Bsymbolic') : ())
);
差异被折叠。
##
## OSSP uuid - Universally Unique Identifier
## Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2004-2007 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.pod: Perl Binding (Perl/POD part)
##
=pod
=head1 NAME
OSSP::uuid - B<OSSP uuid> Perl Binding
=head1 DESCRIPTION
B<OSSP uuid> is a ISO-C:1999 application programming interface (API)
and corresponding command line interface (CLI) for the generation of
DCE 1.1, ISO/IEC 11578:1996 and RFC 4122 compliant I<Universally Unique
Identifier> (UUID). It supports DCE 1.1 variant UUIDs of version 1 (time
and node based), version 3 (name based, MD5), version 4 (random number
based) and version 5 (name based, SHA-1). Additional API bindings are
provided for the languages ISO-C++:1998, Perl:5 and PHP:4/5. Optional
backward compatibility exists for the ISO-C DCE-1.1 and Perl Data::UUID
APIs.
B<OSSP::uuid> is the Perl binding to the B<OSSP uuid> API.
Three variants are provided:
=head2 TIE-STYLE API
The TIE-style API is a functionality-reduced wrapper around the OO-style
API and intended for very high-level convenience programming:
=over 4
=item C<use OSSP::uuid;>
=item B<tie>C< my $uuid, 'OSSP::uuid::tie', $mode, ...;>
=item C<$uuid = [ $mode, ... ];>
=item C<print "UUID=$uuid\n";>
=item C<untie $uuid;>
=back
=head2 OO-STYLE API
The OO-style API is a wrapper around the C-style API and intended for
high-level regular programming.
=over 4
=item C<use OSSP::uuid;>
=item C<my $uuid = >B<new>C< OSSP::uuid;>
=item C<$uuid-E<gt>>B<load>C<($name);>
=item C<$uuid-E<gt>>B<make>C<($mode, ...);>
=item C<$result = $uuid-E<gt>>B<isnil>C<();>
=item C<$result = $uuid-E<gt>>B<compare>C<($uuid2);>
=item C<$uuid-E<gt>>B<import>C<($fmt, $data_ptr);>
=item C<$data_ptr = $uuid-E<gt>>B<export>C<($fmt);>
=item C<[(]$str[, $rc)] = $uuid-E<gt>>B<error>C<();>
=item C<$ver = $uuid-E<gt>>B<version>C<();>
=item C<undef $uuid;>
=back
Additionally, the strings C<"v1">, C<"v3">, C<"v4">, C<"v5"> and C<"mc">
can be used in C<$mode> and the strings C<"bin">, C<"str">, and C<"txt">
can be used for C<$fmt>.
=head2 C-STYLE API
The C-style API is a direct mapping
of the B<OSSP uuid> ISO-C API to Perl and is intended for low-level
programming. See uuid(3) for a description of the functions and
their expected arguments.
=over 4
=item C<use OSSP::uuid qw(:all);>
=item C<my $uuid; $rc = >B<uuid_create>C<($uuid);>
=item C<$rc = >B<uuid_load>C<($uuid, $name);>
=item C<$rc = >B<uuid_make>C<($uuid, $mode, ...);>
=item C<$rc = >B<uuid_isnil>C<($uuid, $result);>
=item C<$rc = >B<uuid_compare>C<($uuid, $uuid2, $result);>
=item C<$rc = >B<uuid_import>C<($uuid, $fmt, $data_ptr, $data_len);>
=item C<$rc = >B<uuid_export>C<($uuid, $fmt, $data_ptr, $data_len);>
=item C<$str = >B<uuid_error>C<($rc);>
=item C<$ver = >B<uuid_version>C<();>
=item C<$rc = >B<uuid_destroy>C<($uuid);>
=back
Additionally, the following constants are exported for use in C<$rc>, C<$mode>, C<$fmt> and C<$ver>:
C<UUID_VERSION>,
C<UUID_LEN_BIN>,
C<UUID_LEN_STR>,
C<UUID_RC_OK>,
C<UUID_RC_ARG>,
C<UUID_RC_MEM>,
C<UUID_RC_SYS>,
C<UUID_RC_INT>,
C<UUID_RC_IMP>,
C<UUID_MAKE_V1>,
C<UUID_MAKE_V3>,
C<UUID_MAKE_V4>,
C<UUID_MAKE_V5>,
C<UUID_MAKE_MC>,
C<UUID_FMT_BIN>,
C<UUID_FMT_STR>,
C<UUID_FMT_SIV>,
C<UUID_FMT_TXT>.
=head1 EXAMPLES
The following two examples create the version 3 UUID
C<02d9e6d5-9467-382e-8f9b-9300a64ac3cd>, both via the OO-style and the
C-style API. Error handling is omitted here for easier reading, but has
to be added for production-quality code.
# TIE-style API (very high-level)
use OSSP::uuid;
tie my $uuid, 'OSSP::uuid::tie';
$uuid = [ "v1" ];
print "UUIDs: $uuid, $uuid, $uuid\n";
$uuid = [ "v3", "ns:URL", "http://www.ossp.org/" ];
print "UUIDs: $uuid, $uuid, $uuid\n";
untie $uuid;
# OO-style API (high-level)
use OSSP::uuid;
my $uuid = new OSSP::uuid;
my $uuid_ns = new OSSP::uuid;
$uuid_ns->load("ns:URL");
$uuid->make("v3", $uuid_ns, "http://www.ossp.org/");
undef $uuid_ns;
my $str = $uuid->export("str");
undef $uuid;
print "$str\n";
# C-style API (low-level)
use OSSP::uuid qw(:all);
my $uuid; uuid_create($uuid);
my $uuid_ns; uuid_create($uuid_ns);
uuid_load($uuid_ns, "ns:URL");
uuid_make($uuid, UUID_MAKE_V3, $uuid_ns, "http://www.ossp.org/");
uuid_destroy($uuid_ns);
my $str; uuid_export($uuid, UUID_FMT_STR, $str, undef);
uuid_destroy($uuid);
print "$str\n";
=head1 SEE ALSO
uuid(1), uuid-config(1), uuid(3).
=head1 HISTORY
The Perl binding B<OSSP::uuid> to B<OSSP uuid> was implemented in
November 2004 by Ralf S. Engelschall E<lt>rse@engelschall.comE<gt>.
=cut
##
## OSSP uuid - Universally Unique Identifier
## Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2004-2007 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.tm: Perl XS typemap for xsubpp(1)
##
TYPEMAP
uuid_t * T_PTRREF
uuid_t ** T_PTRREF
uuid_rc_t T_IV
uuid_fmt_t T_IV
int * T_PV
size_t * T_PV
const void * T_PV
void ** T_PV
##
## OSSP uuid - Universally Unique Identifier
## Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2004-2007 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.ts: Perl Binding (Perl test suite part)
##
use Test::More tests => 36;
##
## Module Loading
##
BEGIN {
use_ok('OSSP::uuid');
};
BEGIN {
use OSSP::uuid qw(:all);
ok(defined(UUID_VERSION), "UUID_VERSION");
ok(UUID_RC_OK == 0, "UUID_RC_OK");
};
##
## C-Style API
##
my ($rc, $result, $uuid, $uuid_ns, $str, $ptr, $len);
$rc = uuid_create($uuid);
ok($rc == UUID_RC_OK, "uuid_create (1)");
$rc = uuid_create($uuid_ns);
ok($rc == UUID_RC_OK, "uuid_create (2)");
$rc = uuid_isnil($uuid, $result);
ok(($rc == UUID_RC_OK and $result == 1), "uuid_isnil (1)");
$rc = uuid_isnil($uuid_ns, $result);
ok(($rc == UUID_RC_OK and $result == 1), "uuid_isnil (2)");
$rc = uuid_compare($uuid, $uuid_ns, $result);
ok(($rc == UUID_RC_OK and $result == 0), "uuid_compare (1)");
$rc = uuid_export($uuid, UUID_FMT_STR, $ptr, $len);
ok(( $rc == UUID_RC_OK
and $ptr eq "00000000-0000-0000-0000-000000000000"
and $len == UUID_LEN_STR), "uuid_export (1)");
$rc = uuid_load($uuid_ns, "ns:URL");
ok($rc == UUID_RC_OK, "uuid_load (1)");
$rc = uuid_export($uuid_ns, UUID_FMT_STR, $ptr, $len);
ok(( $rc == UUID_RC_OK
and $ptr eq "6ba7b811-9dad-11d1-80b4-00c04fd430c8"
and $len == UUID_LEN_STR), "uuid_export (2)");
$rc = uuid_make($uuid, UUID_MAKE_V3, $uuid_ns, "http://www.ossp.org/");
ok($rc == UUID_RC_OK, "uuid_make (1)");
$rc = uuid_export($uuid, UUID_FMT_STR, $ptr, $len);
ok(( $rc == UUID_RC_OK
and $ptr eq "02d9e6d5-9467-382e-8f9b-9300a64ac3cd"
and $len == UUID_LEN_STR), "uuid_export (3)");
$rc = uuid_export($uuid, UUID_FMT_BIN, $ptr, $len);
ok(( $rc == UUID_RC_OK
and $len == UUID_LEN_BIN), "uuid_export (4)");
$rc = uuid_import($uuid_ns, UUID_FMT_BIN, $ptr, $len);
ok($rc == UUID_RC_OK, "uuid_import (1)");
$rc = uuid_export($uuid_ns, UUID_FMT_STR, $ptr, $len);
ok(( $rc == UUID_RC_OK
and $ptr eq "02d9e6d5-9467-382e-8f9b-9300a64ac3cd"
and $len == UUID_LEN_STR), "uuid_export (5)");
$rc = uuid_export($uuid_ns, UUID_FMT_SIV, $ptr, $len);
ok(( $rc == UUID_RC_OK
and $ptr eq "3789866285607910888100818383505376205"
and $len <= UUID_LEN_SIV), "uuid_export (6)");
$rc = uuid_destroy($uuid_ns);
ok($rc == UUID_RC_OK, "uuid_destroy (1)");
$rc = uuid_destroy($uuid);
ok($rc == UUID_RC_OK, "uuid_destroy (2)");
##
## OO-style API
##
$uuid = new OSSP::uuid;
ok(defined($uuid), "new OSSP::uuid (1)");
$uuid_ns = new OSSP::uuid;
ok(defined($uuid_ns), "new OSSP::uuid (2)");
$rc = $uuid->isnil();
ok((defined($rc) and $rc == 1), "isnil (1)");
$rc = $uuid_ns->isnil();
ok((defined($rc) and $rc == 1), "isnil (2)");
$rc = $uuid->compare($uuid_ns);
ok((defined($rc) and $rc == 0), "compare (1)");
$ptr = $uuid->export("str");
ok(( defined($ptr)
and $ptr eq "00000000-0000-0000-0000-000000000000"
and length($ptr) == UUID_LEN_STR), "export (1)");
$rc = $uuid_ns->load("ns:URL");
ok(defined($rc), "uuid_load (1)");
$ptr = $uuid_ns->export("str");
ok(( defined($ptr)
and $ptr eq "6ba7b811-9dad-11d1-80b4-00c04fd430c8"
and length($ptr) == UUID_LEN_STR), "export (2)");
$rc = $uuid->make("v3", $uuid_ns, "http://www.ossp.org/");
ok(defined($rc), "make (1)");
$ptr = $uuid->export("str");
ok(( defined($ptr)
and $ptr eq "02d9e6d5-9467-382e-8f9b-9300a64ac3cd"
and length($ptr) == UUID_LEN_STR), "export (3)");
$ptr = $uuid->export("bin");
ok(( defined($ptr)
and length($ptr) == UUID_LEN_BIN), "export (4)");
$rc = $uuid_ns->import("bin", $ptr);
ok(defined($rc), "import (1)");
$ptr = $uuid_ns->export("str");
ok(( defined($ptr)
and $ptr eq "02d9e6d5-9467-382e-8f9b-9300a64ac3cd"
and length($ptr) == UUID_LEN_STR), "export (5)");
undef $uuid;
undef $uuid_ns;
##
## TIE API
##
$uuid = new OSSP::uuid;
tie my $var, 'OSSP::uuid::tie';
my $val_get1 = $var;
my $val_get2 = $var;
ok($val_get1 ne $val_get2, "subsequent generation");
$uuid->import("str", $val_get1);
my $val_cmp1 = $uuid->export("str");
$uuid->import("str", $val_get2);
my $val_cmp2 = $uuid->export("str");
ok($val_get1 eq $val_cmp1, "validity comparison 1");
ok($val_get2 eq $val_cmp2, "validity comparison 2");
$var = [ "v3", "ns:URL", "http://www.ossp.org/" ];
$val_get1 = $var;
ok($val_get1 eq "02d9e6d5-9467-382e-8f9b-9300a64ac3cd", "generation of UUID v3");
/*
** OSSP uuid - Universally Unique Identifier
** Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2004-2007 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.xs: Perl Binding (Perl/XS part)
*/
#include "uuid.h"
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
MODULE = OSSP::uuid PACKAGE = OSSP::uuid
void
constant(sv)
PREINIT:
dXSTARG;
STRLEN len;
int i;
static struct {
const char *name;
int value;
} constant_table[] = {
{ "UUID_VERSION", UUID_VERSION },
{ "UUID_LEN_BIN", UUID_LEN_BIN },
{ "UUID_LEN_STR", UUID_LEN_STR },
{ "UUID_LEN_SIV", UUID_LEN_SIV },
{ "UUID_RC_OK", UUID_RC_OK },
{ "UUID_RC_ARG", UUID_RC_ARG },
{ "UUID_RC_MEM", UUID_RC_MEM },
{ "UUID_RC_SYS", UUID_RC_SYS },
{ "UUID_RC_INT", UUID_RC_INT },
{ "UUID_RC_IMP", UUID_RC_IMP },
{ "UUID_MAKE_V1", UUID_MAKE_V1 },
{ "UUID_MAKE_V3", UUID_MAKE_V3 },
{ "UUID_MAKE_V4", UUID_MAKE_V4 },
{ "UUID_MAKE_V5", UUID_MAKE_V5 },
{ "UUID_MAKE_MC", UUID_MAKE_MC },
{ "UUID_FMT_BIN", UUID_FMT_BIN },
{ "UUID_FMT_STR", UUID_FMT_STR },
{ "UUID_FMT_SIV", UUID_FMT_SIV },
{ "UUID_FMT_TXT", UUID_FMT_TXT }
};
INPUT:
SV *sv;
const char *s = SvPV(sv, len);
PPCODE:
for (i = 0; i < sizeof(constant_table)/sizeof(constant_table[0]); i++) {
if (strcmp(s, constant_table[i].name) == 0) {
EXTEND(SP, 1);
PUSHs(&PL_sv_undef);
PUSHi(constant_table[i].value);
break;
}
}
if (i == sizeof(constant_table)/sizeof(constant_table[0])) {
sv = sv_2mortal(newSVpvf("unknown contant OSSP::uuid::%s", s));
PUSHs(sv);
}
uuid_rc_t
uuid_create(uuid)
PROTOTYPE:
$
INPUT:
uuid_t *&uuid = NO_INIT
CODE:
RETVAL = uuid_create(&uuid);
OUTPUT:
uuid
RETVAL
uuid_rc_t
uuid_destroy(uuid)
PROTOTYPE:
$
INPUT:
uuid_t *uuid
CODE:
RETVAL = uuid_destroy(uuid);
OUTPUT:
RETVAL
uuid_rc_t
uuid_load(uuid,name)
PROTOTYPE:
$$
INPUT:
uuid_t *uuid
const char *name
CODE:
RETVAL = uuid_load(uuid, name);
OUTPUT:
RETVAL
uuid_rc_t
uuid_make(uuid,mode,...)
PROTOTYPE:
$$;$$
INPUT:
uuid_t *uuid
unsigned int mode
PREINIT:
uuid_t *ns;
const char *name;
CODE:
if ((mode & UUID_MAKE_V3) || (mode & UUID_MAKE_V5)) {
if (items != 4)
croak("mode UUID_MAKE_V3/UUID_MAKE_V5 requires two additional arguments to uuid_make()");
if (!SvROK(ST(2)))
croak("mode UUID_MAKE_V3/UUID_MAKE_V5 requires a UUID object as namespace");
ns = INT2PTR(uuid_t *, SvIV((SV*)SvRV(ST(2))));
name = (const char *)SvPV_nolen(ST(3));
RETVAL = uuid_make(uuid, mode, ns, name);
}
else {
if (items != 2)
croak("invalid number of arguments to uuid_make()");
RETVAL = uuid_make(uuid, mode);
}
OUTPUT:
RETVAL
uuid_rc_t
uuid_isnil(uuid,result)
PROTOTYPE:
$$
INPUT:
uuid_t *uuid
int &result = NO_INIT
CODE:
RETVAL = uuid_isnil(uuid, &result);
OUTPUT:
result
RETVAL
uuid_rc_t
uuid_compare(uuid,uuid2,result)
PROTOTYPE:
$$$
INPUT:
uuid_t *uuid
uuid_t *uuid2
int &result = NO_INIT
CODE:
RETVAL = uuid_compare(uuid, uuid2, &result);
OUTPUT:
result
RETVAL
uuid_rc_t
uuid_import(uuid,fmt,data_ptr,data_len)
PROTOTYPE:
$$$$
INPUT:
uuid_t *uuid
uuid_fmt_t fmt
const void *data_ptr
size_t data_len
CODE:
if (ST(3) == &PL_sv_undef)
data_len = sv_len(ST(2));
RETVAL = uuid_import(uuid, fmt, data_ptr, data_len);
OUTPUT:
RETVAL
uuid_rc_t
uuid_export(uuid,fmt,data_ptr,data_len)
PROTOTYPE:
$$$$
INPUT:
uuid_t *uuid
uuid_fmt_t fmt
void *&data_ptr = NO_INIT
size_t &data_len = NO_INIT
PPCODE:
data_ptr = NULL;
data_len = 0;
RETVAL = uuid_export(uuid, fmt, &data_ptr, &data_len);
if (RETVAL == UUID_RC_OK) {
if (fmt == UUID_FMT_SIV)
data_len = strlen((char *)data_ptr);
else if (fmt == UUID_FMT_STR || fmt == UUID_FMT_TXT)
data_len--; /* Perl doesn't wish NUL-termination on strings */
sv_setpvn(ST(2), data_ptr, data_len);
free(data_ptr);
if (ST(3) != &PL_sv_undef)
sv_setuv(ST(3), (UV)data_len);
}
PUSHi((IV)RETVAL);
char *
uuid_error(rc)
PROTOTYPE:
$
INPUT:
uuid_rc_t rc
CODE:
RETVAL = uuid_error(rc);
OUTPUT:
RETVAL
unsigned long
uuid_version()
PROTOTYPE:
INPUT:
CODE:
RETVAL = uuid_version();
OUTPUT:
RETVAL
##
## OSSP uuid - Universally Unique Identifier
## Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2004-2007 The OSSP Project <http://www.ossp.org/>
## Copyright (c) 2004 Piotr Roszatycki <dexter@debian.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_compat.pm: Data::UUID Backward Compatibility Perl API
##
package Data::UUID;
use 5.006;
use warnings;
use strict;
use OSSP::uuid;
use MIME::Base64 qw();
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(NameSpace_DNS NameSpace_OID NameSpace_URL NameSpace_X500);
our $VERSION = do { my @v = ('1.6.2' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @v); };
sub new {
my $class = shift;
my $self = bless {}, $class;
return $self;
}
sub create {
my ($self) = @_;
my $uuid = OSSP::uuid->new;
$uuid->make('v4');
return $uuid->export('bin');
}
sub create_from_name {
my ($self, $nsid, $name) = @_;
my $uuid = OSSP::uuid->new;
my $nsiduuid = OSSP::uuid->new;
$nsiduuid->import('bin', $nsiduuid);
$uuid = OSSP::uuid->new;
$uuid->make('v3', $nsiduuid, $name);
return $uuid->export('bin');
}
sub to_string {
my ($self, $bin) = @_;
my $uuid = OSSP::uuid->new;
$uuid->import('bin', $bin);
return $uuid->export('str');
}
sub to_hexstring {
my ($self, $bin) = @_;
my $uuid = OSSP::uuid->new;
$uuid->import('bin', $bin);
(my $string = '0x' . $uuid->export('str')) =~ s/-//g;
return $string;
}
sub to_b64string {
my ($self, $bin) = @_;
return MIME::Base64::encode_base64($bin, '');
}
sub from_string {
my ($self, $str) = @_;
my $uuid = OSSP::uuid->new;
$uuid->import('str',
$str =~ /^0x/
? join '-', unpack('x2 a8 a4 a4 a4 a12', $str)
: $str
);
return $uuid->export('bin');
}
sub from_hexstring {
my ($self, $str) = @_;
my $uuid = OSSP::uuid->new;
$uuid->import('str', join '-', unpack('x2 a8 a4 a4 a4 a12', $str));
return $uuid->export('bin');
}
sub from_b64string {
my ($self, $b64) = @_;
return MIME::Base64::decode_base64($b64);
}
sub compare {
my ($self, $bin1, $bin2) = @_;
my $uuid1 = OSSP::uuid->new;
my $uuid2 = OSSP::uuid->new;
$uuid1->import('bin', $bin1);
$uuid2->import('bin', $bin2);
return $uuid1->compare($uuid2);
}
my %NS = (
'NameSpace_DNS' => 'ns:DNS',
'NameSpace_URL' => 'ns:URL',
'NameSpace_OID' => 'ns:OID',
'NameSpace_X500' => 'ns:X500',
);
while (my ($k, $v) = each %NS) {
no strict 'refs';
*{$k} = sub () {
my $uuid = OSSP::uuid->new;
$uuid->load($v);
return $uuid->export('bin');
};
}
sub constant {
my ($self, $arg) = @_;
my $uuid = OSSP::uuid->new;
$uuid->load($NS{$arg} || 'nil');
return $uuid->export('bin');
}
sub create_str {
my $self = shift;
return $self->to_string($self->create);
}
sub create_hex {
my $self = shift;
return $self->to_hexstring($self->create);
}
sub create_b64 {
my $self = shift;
return $self->to_b64string($self->create);
}
sub create_from_name_str {
my $self = shift;
return $self->to_string($self->create_from_name(@_));
}
sub create_from_name_hex {
my $self = shift;
return $self->to_hexstring($self->create_from_name(@_));
}
sub create_from_name_b64 {
my $self = shift;
return $self->to_b64string($self->create_from_name(@_));
}
1;
##
## OSSP uuid - Universally Unique Identifier
## Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2004-2007 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_compat.pod: Data::UUID Backward Compatibility Perl API (Perl/POD part)
##
=pod
=head1 NAME
Data::UUID - B<OSSP uuid> Backward Compatibility Perl Binding
=head1 DESCRIPTION
B<Data::UUID> is the B<OSSP uuid> backward compatibility Perl binding
to the API of the original B<Data::UUID> module. It allows other
B<Data::UUID> based Perl modules to run with B<OSSP::uuid> without
changes.
=head1 SEE ALSO
B<OSSP::uuid>.
=head1 HISTORY
The backward compatibility Perl binding B<Data::UUID> for B<OSSP
uuid> was originally implemented in 2004 by Piotr Roszatycki
E<lt>dexter@debian.orgE<gt>. It was later cleaned up and speed optimized
in December 2005 by David Wheeler E<lt>david@justatheory.comE<gt>.
=cut
##
## OSSP uuid - Universally Unique Identifier
## Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2004-2007 The OSSP Project <http://www.ossp.org/>
## Copyright (c) 2004 Piotr Roszatycki <dexter@debian.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_compat.ts: Data::UUID Backward Compatibility Perl API (Perl test suite part)
##
use Test::More tests => 14;
BEGIN {
use_ok('Data::UUID');
use Data::UUID;
};
ok($ug = new Data::UUID);
ok($uuid1 = $ug->create());
ok($uuid2 = $ug->to_hexstring($uuid1));
ok($uuid3 = $ug->from_string($uuid2));
ok($ug->compare($uuid1, $uuid3) == 0);
ok($uuid4 = $ug->to_b64string($uuid1));
ok($uuid5 = $ug->to_b64string($uuid3));
ok($uuid4 eq $uuid5);
ok($uuid6 = $ug->from_b64string($uuid5));
ok($ug->compare($uuid6, $uuid1) == 0);
ok($uuid7 = NameSpace_URL);
ok($uuid8 = $ug->from_string("6ba7b811-9dad-11d1-80b4-00c04fd430c8"));
ok($ug->compare($uuid7, $uuid8) == 0);
##
## Makefile for PostgreSQL extension module
##
# NOTICE: This requires GNU make as the PostgreSQL PGXS build
# environment is based on GNU make features!
#
# NOTICE: Usually one would just use "PGXS := $(shell pg_config
# --pgxs)" followed by "include $(PGXS)" as the template. The problem
# just is that this way (at least still under PostgreSQL 8.1) one
# cannot pass the "-L../.libs -luuid" to the command which links the
# DSO. Hence we fiddle around with the Makefiles which "PGXS" uses
# itself ourself.
PG_CONFIG ?= pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
POSTGRES := $(shell $(PG_CONFIG) --bindir)/postgres
top_builddir := $(dir $(PGXS))../..
include $(top_builddir)/src/Makefile.global
NAME = uuid
OBJS = uuid.o
SO_MAJOR_VERSION = 1
SO_MINOR_VERSION = 0
override CPPFLAGS := -I.. $(CPPFLAGS)
SHLIB_LINK := -L../.libs -luuid
SHLIB_LINK += $(shell test $(shell uname -s) = FreeBSD && echo "-Wl,-Bsymbolic")
SHLIB_LINK += $(shell test $(shell uname -s) = Darwin && echo "-bundle_loader $(POSTGRES)")
rpath :=
all: uuid.sql all-lib
enable_shared = yes
include $(top_builddir)/src/Makefile.shlib
uuid.sql: uuid.sql.in
sed -e 's;MODULE_PATHNAME;$(DESTDIR)$(pkglibdir)/uuid$(DLSUFFIX);g' <uuid.sql.in >uuid.sql
install: all
$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
$(mkinstalldirs) $(DESTDIR)$(datadir)
$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/uuid$(DLSUFFIX)
$(INSTALL_DATA) uuid.sql $(DESTDIR)$(datadir)/uuid.sql
uninstall:
-rm -f $(DESTDIR)$(pkglibdir)/uuid$(DLSUFFIX)
-rm -f $(DESTDIR)$(datadir)/uuid.sql
clean distclean: clean-lib
rm -f $(OBJS)
rm -f uuid.sql
realclean: distclean
test:
差异被折叠。
--
-- OSSP uuid - Universally Unique Identifier
-- Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
-- Copyright (c) 2004-2007 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.sql: PostgreSQL Binding (SQL part)
--
--
-- prolog
--
SET search_path TO public;
SET client_min_messages TO warning;
DROP FUNCTION uuid_in(CSTRING) CASCADE;
DROP FUNCTION uuid_out(uuid) CASCADE;
DROP FUNCTION uuid_recv(INTERNAL) CASCADE;
DROP FUNCTION uuid_send(uuid) CASCADE;
DROP TYPE uuid CASCADE;
DROP CAST (CSTRING AS uuid) CASCADE;
DROP CAST (uuid AS CSTRING) CASCADE;
DROP FUNCTION uuid(CSTRING) CASCADE;
DROP FUNCTION uuid(INTEGER) CASCADE;
DROP FUNCTION uuid(INTEGER, CSTRING, CSTRING) CASCADE;
DROP FUNCTION uuid_eq(uuid) CASCADE;
DROP FUNCTION uuid_ne(uuid) CASCADE;
DROP FUNCTION uuid_lt(uuid, uuid) CASCADE;
DROP FUNCTION uuid_gt(uuid, uuid) CASCADE;
DROP FUNCTION uuid_le(uuid, uuid) CASCADE;
DROP FUNCTION uuid_ge(uuid, uuid) CASCADE;
DROP OPERATOR =(uuid,uuid) CASCADE;
DROP OPERATOR <>(uuid,uuid) CASCADE;
DROP OPERATOR <(uuid,uuid) CASCADE;
DROP OPERATOR >(uuid,uuid) CASCADE;
DROP OPERATOR <=(uuid,uuid) CASCADE;
DROP OPERATOR >=(uuid,uuid) CASCADE;
DROP FUNCTION uuid_hash(uuid) CASCADE;
DROP FUNCTION uuid_cmp(uuid, uuid) CASCADE;
DROP OPERATOR CLASS uuid_ops USING hash CASCADE;
DROP OPERATOR CLASS uuid_ops USING btree CASCADE;
BEGIN;
--
-- the UUID data type
--
CREATE FUNCTION
uuid_in(CSTRING) RETURNS uuid
STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_in';
CREATE FUNCTION
uuid_out(uuid) RETURNS CSTRING
STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_out';
CREATE FUNCTION
uuid_recv(INTERNAL) RETURNS uuid
STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_recv';
CREATE FUNCTION
uuid_send(uuid) RETURNS BYTEA
STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_send';
CREATE TYPE uuid (
INPUT = uuid_in, -- for SQL input
OUTPUT = uuid_out, -- for SQL output
RECEIVE = uuid_recv, -- for DB input
SEND = uuid_send, -- for DB output
DEFAULT = 'uuid(1)',
INTERNALLENGTH = 16,
ALIGNMENT = char
);
COMMENT ON TYPE uuid
IS 'UUID type';
-- CREATE CAST (CSTRING AS uuid)
-- WITH FUNCTION uuid_in(CSTRING) AS ASSIGNMENT;
--
-- CREATE CAST (uuid AS CSTRING)
-- WITH FUNCTION uuid_out(uuid) AS ASSIGNMENT;
--
-- the UUID constructor function
--
CREATE FUNCTION
uuid(CSTRING) RETURNS uuid
IMMUTABLE STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_in';
CREATE FUNCTION
uuid(INTEGER) RETURNS uuid
VOLATILE CALLED ON NULL INPUT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_make';
CREATE FUNCTION
uuid(INTEGER, CSTRING, CSTRING) RETURNS uuid
VOLATILE CALLED ON NULL INPUT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_make';
--
-- the UUID operators
--
CREATE FUNCTION
uuid_eq(uuid, uuid) RETURNS BOOL
IMMUTABLE STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_eq';
CREATE FUNCTION
uuid_ne(uuid, uuid) RETURNS BOOL
IMMUTABLE STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_ne';
CREATE FUNCTION
uuid_lt(uuid, uuid) RETURNS BOOL
IMMUTABLE STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_lt';
CREATE FUNCTION
uuid_gt(uuid, uuid) RETURNS BOOL
IMMUTABLE STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_gt';
CREATE FUNCTION
uuid_le(uuid, uuid) RETURNS BOOL
IMMUTABLE STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_le';
CREATE FUNCTION
uuid_ge(uuid, uuid) RETURNS BOOL
IMMUTABLE STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_ge';
CREATE OPERATOR = (
leftarg = uuid,
rightarg = uuid,
negator = <>,
procedure = uuid_eq
);
CREATE OPERATOR <> (
leftarg = uuid,
rightarg = uuid,
negator = =,
procedure = uuid_ne
);
CREATE OPERATOR < (
leftarg = uuid,
rightarg = uuid,
commutator = >,
negator = >=,
procedure = uuid_lt
);
CREATE OPERATOR > (
leftarg = uuid,
rightarg = uuid,
commutator = <,
negator = <=,
procedure = uuid_gt
);
CREATE OPERATOR <= (
leftarg = uuid,
rightarg = uuid,
commutator = >=,
negator = >,
procedure = uuid_le
);
CREATE OPERATOR >= (
leftarg = uuid,
rightarg = uuid,
commutator = <=,
negator = <,
procedure = uuid_ge
);
--
-- the UUID support for indexing
--
CREATE FUNCTION
uuid_hash(uuid) RETURNS INTEGER
IMMUTABLE STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_hash';
CREATE FUNCTION
uuid_cmp(uuid, uuid) RETURNS INTEGER
IMMUTABLE STRICT
LANGUAGE C AS 'MODULE_PATHNAME', 'pg_uuid_cmp';
CREATE OPERATOR CLASS uuid_ops
DEFAULT FOR TYPE uuid USING hash AS
OPERATOR 1 =, -- 1: equal
FUNCTION 1 uuid_hash(uuid);
CREATE OPERATOR CLASS uuid_ops
DEFAULT FOR TYPE uuid USING btree AS
OPERATOR 1 <, -- 1: less than
OPERATOR 2 <=, -- 2: less than or equal
OPERATOR 3 =, -- 3: equal
OPERATOR 4 >=, -- 4: greater than or equal
OPERATOR 5 >, -- 5: greater than
FUNCTION 1 uuid_cmp(uuid, uuid);
--
-- epilog
--
COMMIT;
OSSP uuid bindings for PostgreSQL
=================================
This is the OSSP uuid binding for the PostgreSQL RDBMS, providing
native UUID data type support.
Installation
------------
In order to install the OSSP uuid binding into the PostgreSQL database
<database> one has run:
$ <prefix>/bin/psql \
-d <database> \
-U postgresql \
-f <prefix>/share/postgresql/uuid.sql
Usage
-----
psql -d <database>
psql> CREATE TABLE test (id UUID DEFAULT uuid(1), name TEXT);
psql> INSERT INTO test (name) VALUES
('foo');
psql> INSERT INTO test (id, name) VALUES
(uuid(1), 'bar');
psql> INSERT INTO test (id, name) VALUES
(uuid(3, 'ns:URL', 'http://www.ossp.org/'), 'baz');
psql> INSERT INTO test (id, name) VALUES
(uuid(3, '6ba7b811-9dad-11d1-80b4-00c04fd430c8',
'http://www.ossp.org/'), 'quux');
psql> SELECT uuid(4);
psql> SELECT * FROM test WHERE id = uuid(3, 'ns:URL', 'http://www.ossp.org/');
psql> DROP TABLE test;
##
## OSSP uuid - Universally Unique Identifier
## Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2004-2007 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.
##
## Makefile.local: PHP/Zend API build procedure (language: make)
##
PHP = php
EXTDIR = `$(PHP)-config --extension-dir`
DESTDIR =
all: build
config:
@if [ ! -f ./configure ]; then $(PHP)ize 2>/dev/null; fi
@if [ ! -f ./Makefile ]; then ./configure --with-php-config=$(PHP)-config; fi
build: config
@$(MAKE) $(MFLAGS) -f Makefile
test: build
@version=`$(PHP)-config --version | sed -e 's;^\([0-9]\).*$$;\1;'`; \
$(PHP) -q -d "safe_mode=0" -d "extension_dir=./" uuid.ts $$version
install: build
@version=`$(PHP)-config --version | sed -e 's;^\([0-9]\).*$$;\1;'`; extdir="$(EXTDIR)"; \
echo "installing PHP$$version API into $$extdir"; \
./build/shtool mkdir -f -p -m 755 $(DESTDIR)$$extdir; \
./build/shtool install -c -m 755 modules/uuid.so $(DESTDIR)$$extdir/uuid.so; \
./build/shtool install -c -m 644 uuid.php$$version $(DESTDIR)$$extdir/uuid.php
clean:
@$(MAKE) $(MFLAGS) -f Makefile clean || true
distclean: clean
-rm -f Makefile .deps
-rm -f config.status configure.lineno
-rm -f config.h config.log
-rm -f *.core *~
realclean: distclean
-rm -rf autom4te.cache build include modules
-rm -f Makefile.fragments Makefile.objects Makefile.global
-rm -f acinclude.m4 aclocal.m4
-rm -f config.guess config.h.in config.nice config.sub
-rm -f configure configure.in
-rm -f install-sh libtool ltmain.sh missing mkinstalldirs
-rm -f run-tests.php
dnl
dnl OSSP uuid - Universally Unique Identifier
dnl Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
dnl Copyright (c) 2004-2007 The OSSP Project <http://www.ossp.org/>
dnl
dnl This file is part of OSSP uuid, a library for the generation
dnl of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
dnl
dnl Permission to use, copy, modify, and distribute this software for
dnl any purpose with or without fee is hereby granted, provided that
dnl the above copyright notice and this permission notice appear in all
dnl copies.
dnl
dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
dnl WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
dnl IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
dnl CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
dnl LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
dnl USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
dnl ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
dnl OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
dnl OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
dnl SUCH DAMAGE.
dnl
dnl config.m4: PHP/Zend API build-time configuration (language: m4)
dnl
PHP_ARG_ENABLE(uuid, OSSP uuid module,
[ --enable-uuid Enable OSSP uuid extension module.])
if test "$PHP_UUID" != "no"; then
PHP_NEW_EXTENSION(uuid, uuid.c, $ext_shared)
AC_DEFINE(HAVE_UUID, 1, [Have OSSP uuid library])
PHP_ADD_LIBPATH([..], )
PHP_ADD_LIBRARY([uuid],, UUID_SHARED_LIBADD)
PHP_ADD_INCLUDE([..])
PHP_SUBST(UUID_SHARED_LIBADD)
dnl avoid linking conflict with a potentially existing uuid_create(3) in libc
AC_CHECK_FUNC(uuid_create,[
SAVE_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
AC_TRY_LINK([],[], [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-Bsymbolic"])
LDFLAGS="$SAVE_LDFLAGS"])
fi
<?xml version="1.0" encoding="ISO-8859-1" ?>
<package>
<name>uuid</name>
<summary>Universally Unique Identifiers (UUID) extension</summary>
<description>
UUID is a PHP extension for the creation
of Universally Unique Identifiers (UUID).
</description>
<license>MIT-Style License</license>
<maintainers>
<maintainer>
<user>rse</user>
<name>Ralf S. Engelschall</name>
<email>rse@engelschall.com</email>
</maintainer>
</maintainers>
<release>
<version>1.0</version>
<date>2003-05-17</date>
<state>unstable</state>
</release>
<configureoptions>
<configureoption name="with-uuid" default="autodetect" prompt="path to OSSP uuid?"/>
</configureoptions>
<filelist>
<dir role="src" name="/">
<file role="src">Makefile.local</file>
<file role="src">config.m4</file>
<file role="src">uuid.c</file>
<file role="php">uuid.php4</file>
<file role="php">uuid.php5</file>
<file role="src">uuid.ts</file>
</dir>
</filelist>
</package>
差异被折叠。
<?php
##
## OSSP uuid - Universally Unique Identifier
## Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2004-2007 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.php: PHP/Zend API (language: php 4.x)
##
class UUID {
var $uuid = null;
function UUID() {
uuid_create(&$this->uuid);
}
function clone() {
$clone = new UUID;
uuid_clone($this->uuid, &$clone->uuid);
return $clone;
}
function load($name) {
uuid_load($this->uuid, $name);
}
function make($fmt, $ns = null, $url = null) {
if (func_num_args() == 3) {
uuid_make($this->uuid, $fmt, $ns->uuid, $url);
}
else {
uuid_make($this->uuid, $fmt);
}
}
function isnil() {
$result = 0;
uuid_isnil($this->uuid, &$result);
return $result;
}
function compare($other) {
$result = 0;
uuid_compare($this->uuid, $other->uuid, &$result);
return $result;
}
function import($fmt, $data) {
uuid_import($this->uuid, $fmt, $data);
}
function export($fmt) {
$data = "";
uuid_export($this->uuid, $fmt, &$data);
return $data;
}
function error($rc) {
return uuid_error($this->uuid, $rc);
}
function version() {
return uuid_version();
}
}
?>
<?php
##
## OSSP uuid - Universally Unique Identifier
## Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2004-2007 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.php: PHP/Zend API (language: php 5.x)
##
class UUID {
private $uuid = null;
public function __construct() {
uuid_create(&$this->uuid);
}
public function __destruct() {
uuid_destroy($this->uuid);
}
public function __clone() {
$uuid = null;
uuid_clone($this->uuid, &$uuid);
$this->uuid = $uuid;
}
public function load($name) {
uuid_load($this->uuid, $name);
}
public function make($fmt, $ns = null, $url = null) {
if (func_num_args() == 3) {
uuid_make($this->uuid, $fmt, $ns->uuid, $url);
}
else {
uuid_make($this->uuid, $fmt);
}
}
public function isnil() {
$result = 0;
uuid_isnil($this->uuid, &$result);
return $result;
}
public function compare($other) {
$result = 0;
uuid_compare($this->uuid, $other->uuid, &$result);
return $result;
}
public function import($fmt, $data) {
uuid_import($this->uuid, $fmt, $data);
}
public function export($fmt) {
$data = "";
uuid_export($this->uuid, $fmt, &$data);
return $data;
}
public function error($rc) {
return uuid_error($this->uuid, $rc);
}
public function version() {
return uuid_version();
}
}
?>
<?php
##
## OSSP uuid - Universally Unique Identifier
## Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2004-2007 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.ts: PHP/Zend API test procedure (language: php)
##
##
## INITIALIZATION
##
$php_version = $argv[1];
print "++ loading DSO uuid.so (low-level API)\n";
if (!extension_loaded('uuid')) {
dl('modules/uuid.so');
}
print "++ loading PHP uuid.php${php_version} (high-level API)\n";
require "uuid.php${php_version}";
print "++ establishing assertion environment\n";
assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 0);
assert_options(ASSERT_QUIET_EVAL, 1);
function my_assert_handler($file, $line, $code)
{
echo "ASSERTION FAILED: $file: $line: $code\n";
exit(1);
}
assert_options(ASSERT_CALLBACK, 'my_assert_handler');
##
## LOW-LEVEL API TESTING
##
print "++ testing low-level C-style API:\n";
$uuid = 42;
$rc = uuid_create(&$uuid);
assert('$rc == 0');
assert('$uuid != 42');
$rc = uuid_make($uuid, UUID_MAKE_V1);
assert('$rc == 0');
$str = "foo";
$rc = uuid_export($uuid, UUID_FMT_STR, &$str);
assert('$rc == 0');
assert('$str != "foo"');
print "UUID: $str\n";
$uuid_ns = 42;
$rc = uuid_create(&$uuid_ns);
assert('$rc == 0');
$rc = uuid_load($uuid_ns, "ns:URL");
assert('$rc == 0');
$rc = uuid_make($uuid, UUID_MAKE_V3, $uuid_ns, "http://www.ossp.org/");
assert('$rc == 0');
$str = "bar";
$rc = uuid_export($uuid, UUID_FMT_STR, &$str);
assert('$rc == 0');
assert('$str != "bar"');
#assert('$str == "02d9e6d5-9467-382e-8f9b-9300a64ac3cd"');
print "UUID: $str\n";
$rc = uuid_destroy($uuid);
assert('$rc == 0');
$rc = uuid_create(&$uuid);
assert('$rc == 0');
$rc = uuid_import($uuid, UUID_FMT_STR, $str);
assert('$rc == 0');
$str = "baz";
$rc = uuid_export($uuid, UUID_FMT_STR, &$str);
assert('$rc == 0');
assert('$str != "baz"');
#assert('$str == "02d9e6d5-9467-382e-8f9b-9300a64ac3cd"');
print "UUID: $str\n";
$clone = null;
$rc = uuid_clone($uuid, &$clone);
assert('$rc == 0');
assert('$clone != null');
$rc = uuid_destroy($uuid);
assert('$rc == 0');
$str = "quux";
$rc = uuid_export($clone, UUID_FMT_STR, &$str);
assert('$rc == 0');
assert('$str != "quux"');
#assert('$str == "02d9e6d5-9467-382e-8f9b-9300a64ac3cd"');
print "UUID: $str\n";
##
## HIGH-LEVEL API TESTING
##
print "++ testing high-level OO-style API:\n";
$uuid = new UUID;
$uuid->make(UUID_MAKE_V1);
$str = $uuid->export(UUID_FMT_STR);
print "UUID: $str\n";
$uuid_ns = new UUID;
$uuid_ns->load("ns:URL");
$uuid->make(UUID_MAKE_V3, $uuid_ns, "http://www.ossp.org/");
$str = $uuid->export(UUID_FMT_STR);
print "UUID: $str\n";
$uuid = null;
$uuid_ns = null;
$uuid = new UUID;
$uuid->import(UUID_FMT_STR, $str);
$str = $uuid->export(UUID_FMT_STR);
print "UUID: $str\n";
if ($php_version == 4) {
eval('$clone = $uuid->clone();');
}
else {
eval('$clone = clone $uuid;');
}
$uuid = null;
$str = $clone->export(UUID_FMT_STR);
print "UUID: $str\n";
$clone = null;
?>
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论