summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2007-12-27 00:08:36 (UTC)
committer Michael Krelin <hacker@klever.net>2008-01-04 18:17:46 (UTC)
commited6883769a03b36402c2c78b1dcee0c7efeb70bc (patch) (side-by-side diff)
treeec96f9c7feeb02d2822ec9872b937b54ab82fb8a
parente63de16a9885641b5070ec834225cb562bc2042f (diff)
downloadlibopkele-ed6883769a03b36402c2c78b1dcee0c7efeb70bc.zip
libopkele-ed6883769a03b36402c2c78b1dcee0c7efeb70bc.tar.gz
libopkele-ed6883769a03b36402c2c78b1dcee0c7efeb70bc.tar.bz2
changed auto_ptr to shared_ptr
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--acinclude.m417
-rw-r--r--configure.ac32
-rw-r--r--include/Makefile.am3
-rw-r--r--include/opkele/consumer.h6
-rw-r--r--include/opkele/server.h4
-rw-r--r--include/opkele/types.h7
6 files changed, 59 insertions, 10 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 80defc7..fbb4cdc 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -154,13 +154,30 @@ AC_DEFUN([AC_WITH_PCREPP],[
AC_SUBST([PCREPP_VERSION])
AC_SUBST([PCREPP_CFLAGS])
AC_SUBST([PCREPP_LIBS])
AC_DEFINE([HAVE_PCREPP],,[pcre++ support])
AC_DEFINE_UNQUOTED([PCREPP_VERSION],["${PCREPP_VERSION}"],[pcre++ version])
$1
fi
fi
fi
fi
])
+dnl AC_CHECK_SHAREDPTR(NS,HEADER[,ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]])
+AC_DEFUN([AC_CHECK_SHAREDPTR],[
+ AC_LANG_PUSH([C++])
+ AC_MSG_CHECKING([for $1::shared_ptr<> in $2])
+ AC_COMPILE_IFELSE([
+ #include <$2>
+ int main(int c,char**v) { $1::shared_ptr<int> spi(new int(0)); return *spi; }
+ ],[
+ AC_MSG_RESULT([found])
+ $3
+ ],[
+ AC_MSG_RESULT([not found])
+ $4
+ ])
+ AC_LANG_POP([C++])
+])
+
m4_include([acinclude.d/libcurl.m4])
diff --git a/configure.ac b/configure.ac
index 1bd1873..c4e9a74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,24 +17,55 @@ AC_MSG_CHECKING([for source tree version])
if headrev=$(cd $srcdir && git rev-parse --verify HEAD 2>/dev/null) ; then
PACKAGE_SRC_VERSION="$(cd $srcdir && git describe --tags $headrev)"
test "$PACKAGE_SRC_VERSION" = "$PACKAGE_VERSION" \
-o "${PACKAGE_SRC_VERSION#${PACKAGE_VERSION}-}" != "$PACKAGE_SRC_VERSION" || PACKAGE_SRC_VERSION="${PACKAGE_VERSION}:${PACKAGE_SRC_VERSION}"
( cd $srcdir && git diff-index $headrev | read dirt ) && PACKAGE_SRC_VERSION="${PACKAGE_SRC_VERSION}-dirty"
else
PACKAGE_SRC_VERSION="$PACKAGE_VERSION"
fi
AC_MSG_RESULT([$PACKAGE_SRC_VERSION])
AC_SUBST([PACKAGE_SRC_VERSION])
AC_DEFINE_UNQUOTED([PACKAGE_SRC_VERSION],["$PACKAGE_SRC_VERSION"],[more or less precise source tree version])
+tr1_mem_std="false"
+tr1_mem_boost="false"
+AC_CHECK_SHAREDPTR(std::tr1,tr1/memory,[ tr1_mem_std=true ])
+AC_CHECK_SHAREDPTR(boost,boost/shared_ptr.hpp,[ tr1_mem_boost=true ])
+tr1_mem=""
+AC_ARG_WITH([tr1-memory],
+ AC_HELP_STRING([--with-tr1-memory=<boost|std>],[select tr1/memory (shared_ptr<>) implementation to use]),
+ [ tr1_mem="$withval" ]
+)
+AC_MSG_CHECKING([for tr1/memory implementation to use])
+test -z "$tr1_mem" && $tr1_mem_std && tr1_mem=std
+test -z "$tr1_mem" && $tr1_mem_boost && tr1_mem=boost
+test -z "$tr1_mem" && AC_MSG_RESULT([none found]) || AC_MSG_RESULT([$tr1_mem])
+case "$tr1_mem" in
+ std)
+ $tr1_mem_std || AC_MSG_ERROR([std implementation requested, but not found])
+ OPKELE_TR1_MEM_NS=std::tr1
+ OPKELE_TR1_MEM_HEADER=tr1/memory
+ ;;
+ boost)
+ $tr1_mem_boost || AC_MSG_ERROR([boost implementation requested, but not found])
+ OPKELE_TR1_MEM_NS=boost
+ OPKELE_TR1_MEM_HEADER=boost/shared_ptr.hpp
+ ;;
+ *)
+ AC_MSG_ERROR([no shared_ptr<> implementation found])
+ ;;
+esac
+AC_SUBST([OPKELE_TR1_MEM_NS])
+AC_SUBST([OPKELE_TR1_MEM_HEADER])
+
PKG_CHECK_MODULES([OPENSSL],[openssl],,[
AC_MSG_ERROR([no openssl library found. get one from http://www.openssl.org/])
])
WANT_KONFORKA="yes"
AC_ARG_ENABLE([konforka],
AC_HELP_STRING([--disable-konforka],[do not use konforka library (default: use if found)]),
[
test "${enableval}" = "no" && WANT_KONFORKA="no"
]
)
if test "${WANT_KONFORKA}" = "yes" ; then
@@ -135,16 +166,17 @@ AC_MSG_CHECKING([for XRI resolver proxy])
AC_ARG_ENABLE([xri-proxy],
AC_HELP_STRING([--with-xri-proxy=url],[set xri proxy for use when resolving xri identities, default is http://xr_proxy_url]),
[ xri_proxy_url="$withval" ]
)
AC_MSG_RESULT([$xri_proxy_url])
AC_DEFINE_UNQUOTED([XRI_PROXY_URL],["$xri_proxy_url"],[XRI proxy resolver URL])
AC_CONFIG_FILES([
Makefile
libopkele.pc
Doxyfile
include/Makefile
+ include/opkele/tr1-mem.h
lib/Makefile
test/Makefile
])
AC_OUTPUT
diff --git a/include/Makefile.am b/include/Makefile.am
index 078c6dc..26cb614 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -3,17 +3,18 @@ nobase_include_HEADERS = \
opkele/opkele-config.h \
opkele/types.h \
opkele/association.h \
opkele/exception.h \
opkele/server.h \
opkele/consumer.h \
opkele/extension.h \
opkele/sreg.h \
opkele/extension_chain.h \
opkele/xconsumer.h \
opkele/xserver.h \
opkele/discovery.h \
- opkele/uris.h
+ opkele/uris.h \
+ opkele/tr1-mem.h
EXTRA_DIST = \
opkele/data.h \
opkele/curl.h opkele/expat.h \
opkele/util.h
diff --git a/include/opkele/consumer.h b/include/opkele/consumer.h
index c463787..3c1d318 100644
--- a/include/opkele/consumer.h
+++ b/include/opkele/consumer.h
@@ -22,25 +22,25 @@ namespace opkele {
class consumer_t {
public:
virtual ~consumer_t() { }
/**
* store association. The function should be overridden in the real
* implementation to provide persistent associations store.
* @param server the OpenID server
* @param handle association handle
* @param secret the secret associated with the server and handle
* @param expires_in the number of seconds until the handle is expired
- * @return the auto_ptr<> for the newly allocated association_t object
+ * @return the assoc_t for the newly allocated association_t object
*/
virtual assoc_t store_assoc(const string& server,const string& handle,const secret_t& secret,int expires_in) = 0;
/**
* retrieve stored association. The function should be overridden
* in the real implementation to provide persistent assocations
* store.
*
* @note
* The user is responsible for handling associations expiry and
* this function should never return an expired or invalidated
* association.
*
@@ -64,45 +64,45 @@ namespace opkele {
*
* @note
* The user is responsible for handling associations and this
* function should never return an expired or invalidated
* association.
*
* @note
* It may be a good idea to pre-expire associations shortly before
* their time is really up to avoid association expiry in the
* middle of negotiations.
*
* @param server the OpenID server
- * @return the auto_ptr<> for the newly allocated association_t object
+ * @return the assoc_t for the newly allocated association_t object
* @throw failed_lookup in case of absence of the handle
*/
virtual assoc_t find_assoc(const string& server);
/**
* retrieve the metainformation contained in link tags from the
* page pointed by url. the function may implement caching of the
* information.
* @param url url to harvest for link tags
* @param server reference to the string object where to put
* openid.server value
* @param delegate reference to the string object where to put the
* openid.delegate value (if any)
*/
virtual void retrieve_links(const string& url,string& server,string& delegate);
/**
* perform the associate request to OpenID server.
* @param server the OpenID server
- * @return the auto_ptr<> for the newly allocated association_t
+ * @return the assoc_t for the newly allocated association_t
* object, representing established association
* @throw exception in case of error
*/
assoc_t associate(const string& server);
/**
* prepare the parameters for the checkid_immediate
* request.
* @param identity the identity to verify
* @param return_to the return_to url to pass with the request
* @param trust_root the trust root to advertise with the request
* @param ext pointer to an extension(s) hooks object
* @return the location string
diff --git a/include/opkele/server.h b/include/opkele/server.h
index dd7fc41..3c25646 100644
--- a/include/opkele/server.h
+++ b/include/opkele/server.h
@@ -16,33 +16,33 @@ namespace opkele {
*/
class server_t {
public:
virtual ~server_t() { }
/**
* allocate the new association. The function should be overridden
* in the real implementation to provide persistent assocations
* store.
* @param mode the mode of request being processed to base the
* statelessness of the association upon
- * @return the auto_ptr<> for the newly allocated association_t object
+ * @return the assoc_t for the newly allocated association_t object
*/
virtual assoc_t alloc_assoc(mode_t mode) = 0;
/**
* retrieve the association. The function should be overridden in
* the reqal implementation to provide persistent assocations
* store.
* @param h association handle
- * @return the auto_ptr<> for the newly allocated association_t object
+ * @return the assoc_t for the newly allocated association_t object
* @throw failed_lookup in case of failure
*/
virtual assoc_t retrieve_assoc(const string& h) = 0;
/**
* validate the identity.
* @param assoc association object
* @param pin incoming request parameters
* @param identity being verified
* @param trust_root presented in the request
* @throw exception if identity can not be confirmed
*/
diff --git a/include/opkele/types.h b/include/opkele/types.h
index ca07df5..d959021 100644
--- a/include/opkele/types.h
+++ b/include/opkele/types.h
@@ -1,33 +1,32 @@
#ifndef __OPKELE_TYPES_H
#define __OPKELE_TYPES_H
/**
* @file
* @brief various types declarations
*/
#include <ostream>
#include <vector>
#include <string>
#include <map>
-#include <memory>
#include <set>
+#include <opkele/tr1-mem.h>
namespace opkele {
using std::vector;
using std::string;
using std::map;
using std::ostream;
- using std::auto_ptr;
using std::multimap;
using std::set;
/**
* the OpenID operation mode
*/
typedef enum _mode_t {
mode_associate,
mode_checkid_immediate,
mode_checkid_setup,
mode_check_association
} mode_t;
@@ -99,27 +98,27 @@ namespace opkele {
* check whether the association is stateless.
* @return true if stateless
*/
virtual bool stateless() const = 0;
/**
* check whether the association is expired.
* @return true if expired
*/
virtual bool is_expired() const = 0;
};
/**
- * the auto_ptr<> for association_t object type
+ * the shared_ptr<> for association_t object type
*/
- typedef auto_ptr<association_t> assoc_t;
+ typedef tr1mem::shared_ptr<association_t> assoc_t;
/**
* request/response parameters map
*/
class params_t : public map<string,string> {
public:
/**
* check whether the parameter is present.
* @param n the parameter name
* @return true if yes
*/